[fractal/bilelmoussaoui/bump-gtk-rs] fix related cargo warnings



commit b7e95e52fbeb9c3b1e755a8f2a67be18c5146c4c
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Mon Aug 3 12:53:32 2020 +0200

    fix related cargo warnings

 fractal-gtk/src/app/connect/account.rs | 20 +++++++++-----------
 fractal-gtk/src/util.rs                |  5 ++---
 2 files changed, 11 insertions(+), 14 deletions(-)
---
diff --git a/fractal-gtk/src/app/connect/account.rs b/fractal-gtk/src/app/connect/account.rs
index 891bedbb..7901a73c 100644
--- a/fractal-gtk/src/app/connect/account.rs
+++ b/fractal-gtk/src/app/connect/account.rs
@@ -105,17 +105,15 @@ impl App {
         let button = name_btn.clone();
         name_entry.connect_property_text_notify(clone!(@strong op => move |w| {
             let username = w.get_text();
-            if username != "" {
-                if op.try_lock()
-                    .ok()
-                    .and_then(|guard| guard.login_data.clone())
-                    .and_then(|login_data| login_data.username)
-                    .filter(|u| *u != username)
-                    .is_some()
-                {
-                    button.show();
-                    return;
-                }
+            if username != "" && op.try_lock()
+                .ok()
+                .and_then(|guard| guard.login_data.clone())
+                .and_then(|login_data| login_data.username)
+                .filter(|u| *u != username)
+                .is_some()
+            {
+                button.show();
+                return;
             }
             button.hide();
         }));
diff --git a/fractal-gtk/src/util.rs b/fractal-gtk/src/util.rs
index 764a8e8e..53642c73 100644
--- a/fractal-gtk/src/util.rs
+++ b/fractal-gtk/src/util.rs
@@ -1,5 +1,4 @@
 use crate::globals::CACHE_PATH;
-use failure::format_err;
 use failure::Error as FailError;
 use gdk::prelude::*;
 use gdk_pixbuf::Pixbuf;
@@ -22,8 +21,8 @@ pub fn cache_dir_path(dir: Option<&str>, name: &str) -> Result<PathBuf, IoError>
 }
 
 pub fn get_pixbuf_data(pb: &Pixbuf) -> Result<Vec<u8>, FailError> {
-    let image = cairo::ImageSurface::create(cairo::Format::ARgb32, pb.get_width(), pb.get_height())
-        .or_else(|_| Err(format_err!("Cairo Error")))?;
+    let image =
+        cairo::ImageSurface::create(cairo::Format::ARgb32, pb.get_width(), pb.get_height())?;
 
     let g = cairo::Context::new(&image);
     g.set_source_pixbuf(pb, 0.0, 0.0);


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