[gnome-tour/bilelmoussaoui/fixes: 11/11] make clippy happy




commit 0c7cab24a6d2db66d0b6a5f0bec28d4e6af72924
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Fri Dec 31 20:01:53 2021 +0100

    make clippy happy

 src/application.rs           |  3 ++-
 src/main.rs                  | 12 ++++--------
 src/widgets/pages/welcome.rs |  2 ++
 3 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/src/application.rs b/src/application.rs
index 1f1bd04..90f2ba1 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -29,7 +29,7 @@ mod imp {
     impl ObjectImpl for Application {}
     impl ApplicationImpl for Application {
         fn activate(&self, application: &Self::Type) {
-            let window = Window::new(&application);
+            let window = Window::new(application);
             application.add_window(&window);
             window.present();
             self.window.set(window.downgrade()).unwrap();
@@ -100,6 +100,7 @@ glib::wrapper! {
 }
 
 impl Application {
+    #[allow(clippy::new_without_default)]
     pub fn new() -> Self {
         glib::Object::new(&[
             ("application-id", &config::APP_ID),
diff --git a/src/main.rs b/src/main.rs
index d12cf44..adf21f5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,14 +14,10 @@ fn main() {
     pretty_env_logger::init();
     // Prepare i18n
     setlocale(LocaleCategory::LcAll, "");
-    bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR).expect(&format!(
-        "Unable to bind text domain for {}",
-        GETTEXT_PACKAGE
-    ));
-    textdomain(GETTEXT_PACKAGE).expect(&format!(
-        "Unable to switch to text domain {}",
-        GETTEXT_PACKAGE
-    ));
+    bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR)
+        .unwrap_or_else(|_| panic!("Unable to bind text domain for {}", GETTEXT_PACKAGE));
+    textdomain(GETTEXT_PACKAGE)
+        .unwrap_or_else(|_| panic!("Unable to switch to text domain {}", GETTEXT_PACKAGE));
 
     glib::set_application_name(&gettext("Tour"));
     glib::set_prgname(Some("Tour"));
diff --git a/src/widgets/pages/welcome.rs b/src/widgets/pages/welcome.rs
index d639b05..7d2d6c2 100644
--- a/src/widgets/pages/welcome.rs
+++ b/src/widgets/pages/welcome.rs
@@ -34,6 +34,7 @@ mod imp {
         sender: Sender<Action>,
     }
 
+    #[allow(clippy::derivable_impls)]
     impl Default for WelcomePageWidget {
         fn default() -> Self {
             #[cfg(feature = "video")]
@@ -191,6 +192,7 @@ glib::wrapper! {
 }
 
 impl WelcomePageWidget {
+    #[allow(clippy::new_without_default)]
     pub fn new() -> Self {
         glib::Object::new(&[]).unwrap()
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]