[niepce/gtk4] rust: Fix clippy warnings



commit c2fecda4f049583c096b5e77f5a82290df38f528
Author: Hubert Figuière <hub figuiere net>
Date:   Fri May 6 00:39:11 2022 -0400

    rust: Fix clippy warnings

 crates/npc-engine/src/db/libmetadata.rs            | 26 +++++++-------
 crates/npc-engine/src/db/library.rs                | 29 ++++++++-------
 crates/npc-fwk/src/base/rgbcolour.rs               |  6 ++--
 crates/npc-fwk/src/toolkit/gdk_utils.rs            |  2 +-
 crates/npc-fwk/src/toolkit/mimetype.rs             |  6 ++--
 crates/npc-fwk/src/toolkit/widgets/rating_label.rs |  2 +-
 crates/npc-fwk/src/utils/exempi.rs                 | 25 ++++++-------
 crates/npc-fwk/src/utils/exiv2.rs                  | 14 ++++----
 crates/npc-fwk/src/utils/files.rs                  |  2 +-
 niepce-main/src/libraryclient/clientimpl.rs        | 42 +++++++++++-----------
 niepce-main/src/niepce/ui/image_list_store.rs      |  8 ++---
 niepce-main/src/niepce/ui/library_cell_renderer.rs |  3 +-
 niepce-main/src/niepce/ui/thumb_strip_view.rs      |  2 +-
 13 files changed, 81 insertions(+), 86 deletions(-)
---
diff --git a/crates/npc-engine/src/db/libmetadata.rs b/crates/npc-engine/src/db/libmetadata.rs
index cab2a34..0eec89e 100644
--- a/crates/npc-engine/src/db/libmetadata.rs
+++ b/crates/npc-engine/src/db/libmetadata.rs
@@ -84,11 +84,11 @@ impl LibMetadata {
         let mut xmp_result =
             self.xmp
                 .xmp
-                .get_property(&index_to_xmp.ns, &index_to_xmp.property, &mut prop_flags);
+                .get_property(index_to_xmp.ns, index_to_xmp.property, &mut prop_flags);
         if xmp_result.is_ok() && prop_flags.contains(exempi::PropFlags::ARRAY_IS_ALTTEXT) {
             if let Ok((_, value)) = self.xmp.xmp.get_localized_text(
-                &index_to_xmp.ns,
-                &index_to_xmp.property,
+                index_to_xmp.ns,
+                index_to_xmp.property,
                 "",
                 "x-default",
                 &mut prop_flags,
@@ -105,22 +105,22 @@ impl LibMetadata {
         if let Some(ix) = property_index_to_xmp(meta) {
             match *value {
                 PropertyValue::Empty => {
-                    return self.xmp.xmp.delete_property(&ix.ns, &ix.property).is_ok()
+                    return self.xmp.xmp.delete_property(ix.ns, ix.property).is_ok()
                 }
                 PropertyValue::Int(i) => {
                     return self
                         .xmp
                         .xmp
-                        .set_property_i32(&ix.ns, &ix.property, i, exempi::PropFlags::NONE)
+                        .set_property_i32(ix.ns, ix.property, i, exempi::PropFlags::NONE)
                         .is_ok()
                 }
                 PropertyValue::String(ref s) => {
                     if s.is_empty() {
-                        return self.xmp.xmp.delete_property(&ix.ns, &ix.property).is_ok();
+                        return self.xmp.xmp.delete_property(ix.ns, ix.property).is_ok();
                     } else if self
                         .xmp
                         .xmp
-                        .set_property(&ix.ns, &ix.property, s, exempi::PropFlags::NONE)
+                        .set_property(ix.ns, ix.property, s, exempi::PropFlags::NONE)
                         .is_err()
                     {
                         if exempi::get_error() == exempi::Error::BadXPath {
@@ -128,8 +128,8 @@ impl LibMetadata {
                                 .xmp
                                 .xmp
                                 .set_localized_text(
-                                    &ix.ns,
-                                    &ix.property,
+                                    ix.ns,
+                                    ix.property,
                                     "",
                                     "x-default",
                                     s,
@@ -142,7 +142,7 @@ impl LibMetadata {
                     }
                 }
                 PropertyValue::StringArray(ref sa) => {
-                    if self.xmp.xmp.delete_property(&ix.ns, &ix.property).is_err() {
+                    if self.xmp.xmp.delete_property(ix.ns, ix.property).is_err() {
                         err_out!("Error deleting property {}", &ix.property);
                         return false;
                     }
@@ -151,8 +151,8 @@ impl LibMetadata {
                             .xmp
                             .xmp
                             .append_array_item(
-                                &ix.ns,
-                                &ix.property,
+                                ix.ns,
+                                ix.property,
                                 exempi::PropFlags::VALUE_IS_ARRAY,
                                 s,
                                 exempi::PropFlags::NONE,
@@ -170,7 +170,7 @@ impl LibMetadata {
                     return self
                         .xmp
                         .xmp
-                        .set_property_date(&ix.ns, &ix.property, &xmp_date, exempi::PropFlags::NONE)
+                        .set_property_date(ix.ns, ix.property, &xmp_date, exempi::PropFlags::NONE)
                         .is_ok();
                 }
             }
diff --git a/crates/npc-engine/src/db/library.rs b/crates/npc-engine/src/db/library.rs
index 00df239..672115f 100644
--- a/crates/npc-engine/src/db/library.rs
+++ b/crates/npc-engine/src/db/library.rs
@@ -195,7 +195,7 @@ impl Library {
                 let mut rows = stmt.query([])?;
                 if let Ok(Some(row)) = rows.next() {
                     let value: String = row.get(0)?;
-                    if let Ok(v) = i32::from_str_radix(&value, 10) {
+                    if let Ok(v) = value.parse::<i32>() {
                         return Ok(v);
                     } else {
                         return Ok(-1);
@@ -450,7 +450,7 @@ impl Library {
             let mut rows = stmt.query(params![id])?;
             let mut files: Vec<LibFile> = vec![];
             while let Ok(Some(row)) = rows.next() {
-                files.push(LibFile::read_from(&row)?);
+                files.push(LibFile::read_from(row)?);
             }
             return Ok(files);
         }
@@ -487,7 +487,7 @@ impl Library {
             }
             let id = conn.last_insert_rowid();
             dbg_out!("last row inserted {}", id);
-            let mut lf = LibFolder::new(id, &name, path);
+            let mut lf = LibFolder::new(id, name, path);
             lf.set_parent(into);
             return Ok(lf);
         }
@@ -523,7 +523,7 @@ impl Library {
                     err_out!("Error {:?}", err);
                     Err(Error::from(err))
                 }
-                Ok(Some(row)) => Ok(LibFolder::read_from(&row)?),
+                Ok(Some(row)) => Ok(LibFolder::read_from(row)?),
             };
         }
         Err(Error::NoSqlDb)
@@ -540,7 +540,7 @@ impl Library {
             let mut rows = stmt.query([])?;
             let mut folders: Vec<LibFolder> = vec![];
             while let Ok(Some(row)) = rows.next() {
-                folders.push(LibFolder::read_from(&row)?);
+                folders.push(LibFolder::read_from(row)?);
             }
             return Ok(folders);
         }
@@ -578,7 +578,7 @@ impl Library {
             let mut rows = stmt.query([])?;
             let mut keywords: Vec<Keyword> = vec![];
             while let Ok(Some(row)) = rows.next() {
-                keywords.push(Keyword::read_from(&row)?);
+                keywords.push(Keyword::read_from(row)?);
             }
             return Ok(keywords);
         }
@@ -846,10 +846,10 @@ impl Library {
                 Err(err) => Err(Error::from(err)),
                 Ok(None) => Err(Error::NotFound),
                 Ok(Some(row)) => {
-                    let mut metadata = LibMetadata::read_from(&row)?;
+                    let mut metadata = LibMetadata::read_from(row)?;
 
                     let sql = "SELECT ext FROM sidecars WHERE file_id=?1";
-                    let mut stmt = conn.prepare(&sql)?;
+                    let mut stmt = conn.prepare(sql)?;
                     let mut rows = stmt.query(params![file_id])?;
                     while let Ok(Some(row)) = rows.next() {
                         metadata.sidecars.push(row.get(0)?);
@@ -937,7 +937,7 @@ impl Library {
                 match *value {
                     PropertyValue::StringArray(ref keywords) => {
                         for kw in keywords {
-                            let id = self.make_keyword(&kw)?;
+                            let id = self.make_keyword(kw)?;
                             if id != -1 {
                                 self.assign_keyword(id, file_id)?;
                             }
@@ -988,7 +988,7 @@ impl Library {
             let mut rows = stmt.query([])?;
             let mut labels: Vec<Label> = vec![];
             while let Ok(Some(row)) = rows.next() {
-                labels.push(Label::read_from(&row)?);
+                labels.push(Label::read_from(row)?);
             }
             return Ok(labels);
         }
@@ -1079,22 +1079,21 @@ impl Library {
                         let xmp_buffer: String = row.get(0)?;
                         let main_file_id: LibraryId = row.get(1)?;
                         let xmp_file_id: LibraryId = row.get(2)?;
-                        let spath: PathBuf;
                         let p = self.get_fs_file(main_file_id);
-                        if let Ok(ref p) = p {
-                            spath = PathBuf::from(p);
+                        let spath = if let Ok(ref p) = p {
+                            PathBuf::from(p)
                         } else {
                             // XXX we should report that error.
                             err_out!("couldn't find the main file {:?}", p);
                             dbg_assert!(false, "couldn't find the main file");
                             continue;
-                        }
+                        };
                         let mut p: Option<PathBuf> = None;
                         if xmp_file_id > 0 {
                             if let Ok(p2) = self.get_fs_file(xmp_file_id) {
                                 p = Some(PathBuf::from(p2));
                             }
-                            dbg_assert!(!p.is_none(), "couldn't find the xmp file path");
+                            dbg_assert!(p.is_some(), "couldn't find the xmp file path");
                         }
                         if p.is_none() {
                             p = Some(spath.with_extension("xmp"));
diff --git a/crates/npc-fwk/src/base/rgbcolour.rs b/crates/npc-fwk/src/base/rgbcolour.rs
index 1807fce..f318162 100644
--- a/crates/npc-fwk/src/base/rgbcolour.rs
+++ b/crates/npc-fwk/src/base/rgbcolour.rs
@@ -60,9 +60,9 @@ impl FromStr for RgbColour {
         if components.len() != 3 {
             return Err(ColourParseError::ParseError);
         }
-        let r = u16::from_str_radix(components[0], 10)?;
-        let g = u16::from_str_radix(components[1], 10)?;
-        let b = u16::from_str_radix(components[2], 10)?;
+        let r = components[0].parse::<u16>()?;
+        let g = components[1].parse::<u16>()?;
+        let b = components[2].parse::<u16>()?;
         Ok(RgbColour::new(r, g, b))
     }
 }
diff --git a/crates/npc-fwk/src/toolkit/gdk_utils.rs b/crates/npc-fwk/src/toolkit/gdk_utils.rs
index feb05b4..10414e2 100644
--- a/crates/npc-fwk/src/toolkit/gdk_utils.rs
+++ b/crates/npc-fwk/src/toolkit/gdk_utils.rs
@@ -90,7 +90,7 @@ fn thumbnail_to_pixbuf(thumbnail: &or::Thumbnail, orientation: i32) -> Option<gd
         DataType::Jpeg | DataType::Tiff | DataType::Png => {
             let loader = gdk_pixbuf::PixbufLoader::new();
 
-            if let Err(err) = loader.write(&buf) {
+            if let Err(err) = loader.write(buf) {
                 err_out!("loader write error: {}", err);
             }
 
diff --git a/crates/npc-fwk/src/toolkit/mimetype.rs b/crates/npc-fwk/src/toolkit/mimetype.rs
index f8fc292..7a98c7a 100644
--- a/crates/npc-fwk/src/toolkit/mimetype.rs
+++ b/crates/npc-fwk/src/toolkit/mimetype.rs
@@ -43,12 +43,12 @@ pub struct MimeType(MType);
 
 /// Guess the type from the gio type string
 pub fn guess_type(gmtype: &str) -> MType {
-    if gio::content_type_is_a(&gmtype, "image/*") {
-        if gio::content_type_is_a(&gmtype, "image/x-dcraw") {
+    if gio::content_type_is_a(gmtype, "image/*") {
+        if gio::content_type_is_a(gmtype, "image/x-dcraw") {
             return MType::Image(IsRaw::Yes);
         }
         return MType::Image(IsRaw::No);
-    } else if gio::content_type_is_a(&gmtype, "video/*") {
+    } else if gio::content_type_is_a(gmtype, "video/*") {
         return MType::Movie;
     }
     MType::None
diff --git a/crates/npc-fwk/src/toolkit/widgets/rating_label.rs 
b/crates/npc-fwk/src/toolkit/widgets/rating_label.rs
index a3a21d4..100802c 100644
--- a/crates/npc-fwk/src/toolkit/widgets/rating_label.rs
+++ b/crates/npc-fwk/src/toolkit/widgets/rating_label.rs
@@ -93,7 +93,7 @@ impl ObjectImpl for RatingLabelPriv {
         let click = gtk4::GestureClick::new();
         click.connect_pressed(glib::clone!(@weak obj => move |gesture, n, x, y| {
             let this = Self::from_instance(&obj);
-            this.press_event(&gesture, n, x, y);
+            this.press_event(gesture, n, x, y);
         }));
         obj.add_controller(&click);
 
diff --git a/crates/npc-fwk/src/utils/exempi.rs b/crates/npc-fwk/src/utils/exempi.rs
index 07c4be3..dbaae02 100644
--- a/crates/npc-fwk/src/utils/exempi.rs
+++ b/crates/npc-fwk/src/utils/exempi.rs
@@ -410,13 +410,12 @@ impl XmpMeta {
 
 pub fn gps_coord_from_xmp(xmps: &str) -> Option<f64> {
     let mut current: &str = xmps;
-    let degs: &str;
 
     // step 1 - degrees
     let sep = current.find(',')?;
     let (d, remainder) = current.split_at(sep);
     current = remainder;
-    degs = d;
+    let degs = d;
 
     // step 2 - minutes
     if current.is_empty() {
@@ -431,8 +430,7 @@ pub fn gps_coord_from_xmp(xmps: &str) -> Option<f64> {
     };
 
     // extract minutes. There are two formats
-    let fminutes: f64;
-    if let Some(sep) = current.find(',') {
+    let fminutes = if let Some(sep) = current.find(',') {
         // DD,mm,ss format
         if sep >= (current.len() - 1) {
             return None;
@@ -445,13 +443,12 @@ pub fn gps_coord_from_xmp(xmps: &str) -> Option<f64> {
         let (seconds, _) = seconds.split_at(seconds.len() - 1);
         let m = minutes.parse::<f64>().ok()?;
         let s = seconds.parse::<f64>().ok()?;
-        fminutes = m + (s / 60f64);
+        m + (s / 60_f64)
     } else {
         // DD,mm.mm format
         let (minutes, _) = current.split_at(current.len() - 1);
-        let m = minutes.parse::<f64>().ok()?;
-        fminutes = m;
-    }
+        minutes.parse::<f64>().ok()?
+    };
 
     let mut deg = degs.parse::<f64>().ok()?;
     if deg > 180.0 {
@@ -477,12 +474,12 @@ pub fn xmp_date_from_exif(d: &str) -> Option<exempi::DateTime> {
         err_out!("ymd split failed {:?}", ymd);
         return None;
     }
-    let year = i32::from_str_radix(ymd[0], 10).ok()?;
-    let month = i32::from_str_radix(ymd[1], 10).ok()?;
+    let year = ymd[0].parse::<i32>().ok()?;
+    let month = ymd[1].parse::<i32>().ok()?;
     if !(1..=12).contains(&month) {
         return None;
     }
-    let day = i32::from_str_radix(ymd[2], 10).ok()?;
+    let day = ymd[2].parse::<i32>().ok()?;
     if !(1..=31).contains(&day) {
         return None;
     }
@@ -491,15 +488,15 @@ pub fn xmp_date_from_exif(d: &str) -> Option<exempi::DateTime> {
         err_out!("hms split failed {:?}", hms);
         return None;
     }
-    let hour = i32::from_str_radix(hms[0], 10).ok()?;
+    let hour = hms[0].parse::<i32>().ok()?;
     if !(0..=23).contains(&hour) {
         return None;
     }
-    let min = i32::from_str_radix(hms[1], 10).ok()?;
+    let min = hms[1].parse::<i32>().ok()?;
     if !(0..=59).contains(&min) {
         return None;
     }
-    let sec = i32::from_str_radix(hms[2], 10).ok()?;
+    let sec = hms[2].parse::<i32>().ok()?;
     if !(0..=59).contains(&sec) {
         return None;
     }
diff --git a/crates/npc-fwk/src/utils/exiv2.rs b/crates/npc-fwk/src/utils/exiv2.rs
index 7a3f3f1..5231ba2 100644
--- a/crates/npc-fwk/src/utils/exiv2.rs
+++ b/crates/npc-fwk/src/utils/exiv2.rs
@@ -254,7 +254,7 @@ lazy_static::lazy_static! {
 fn convert(conversion: Conversion, value: &str) -> Converted {
     match conversion {
         Conversion::None => Converted::Str(value.to_string()),
-        Conversion::ExifDate => Converted::Date(xmp_date_from_exif(&value)),
+        Conversion::ExifDate => Converted::Date(xmp_date_from_exif(value)),
         _ => {
             err_out!("Conversion error fro str to {:?}", conversion);
             Converted::Str(value.to_string())
@@ -329,7 +329,7 @@ fn int_tag_to_xmp(
     // XXX rexiv2 returns an i32, which is a problem for UnsignedLong
     match xmp_prop.2 {
         Conversion::Flash => {
-            if let Converted::Flash(flash) = convert_int(xmp_prop.2, meta.get_tag_numeric(&tag)) {
+            if let Converted::Flash(flash) = convert_int(xmp_prop.2, meta.get_tag_numeric(tag)) {
                 if let Err(err) = flash.set_as_xmp_property(xmp, NS_EXIF, "Flash") {
                     err_out!(
                         "Error setting property {} {}: {:?}",
@@ -341,7 +341,7 @@ fn int_tag_to_xmp(
             }
         }
         Conversion::None => {
-            let value = meta.get_tag_numeric(&tag);
+            let value = meta.get_tag_numeric(tag);
             if let Err(err) =
                 xmp.set_property_i32(xmp_prop.0, xmp_prop.1, value, exempi::PropFlags::NONE)
             {
@@ -354,7 +354,7 @@ fn int_tag_to_xmp(
             }
         }
         Conversion::Interpreted => {
-            if let Ok(value) = meta.get_tag_interpreted_string(&tag) {
+            if let Ok(value) = meta.get_tag_interpreted_string(tag) {
                 if let Err(err) =
                     xmp.set_property(xmp_prop.0, xmp_prop.1, &value, exempi::PropFlags::NONE)
                 {
@@ -369,7 +369,7 @@ fn int_tag_to_xmp(
         }
         _ => {
             err_out!("Unknown conversion from {:?} to {:?}", tagtype, xmp_prop.2);
-            let value = meta.get_tag_numeric(&tag);
+            let value = meta.get_tag_numeric(tag);
             if let Err(err) =
                 xmp.set_property_i32(xmp_prop.0, xmp_prop.1, value, exempi::PropFlags::NONE)
             {
@@ -403,7 +403,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
                     let tagtype = rexiv2::get_tag_type(&tag);
                     match tagtype {
                         Ok(rexiv2::TagType::AsciiString) => {
-                            ascii_tag_to_xmp(&meta, &tag, &xmp_prop, &mut xmp);
+                            ascii_tag_to_xmp(&meta, &tag, xmp_prop, &mut xmp);
                         }
                         Ok(rexiv2::TagType::UnsignedShort)
                         | Ok(rexiv2::TagType::UnsignedLong)
@@ -413,7 +413,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
                                 &meta,
                                 &tag,
                                 *tagtype.as_ref().unwrap(),
-                                &xmp_prop,
+                                xmp_prop,
                                 &mut xmp,
                             );
                         }
diff --git a/crates/npc-fwk/src/utils/files.rs b/crates/npc-fwk/src/utils/files.rs
index acd5858..d30f961 100644
--- a/crates/npc-fwk/src/utils/files.rs
+++ b/crates/npc-fwk/src/utils/files.rs
@@ -49,7 +49,7 @@ impl FileList {
             gio::FileQueryInfoFlags::NONE,
             Option::<&gio::Cancellable>::None,
         ) {
-            for itr in enumerator.into_iter() {
+            for itr in enumerator {
                 if itr.is_err() {
                     err_out!("Enumeration failed: {:?}", itr.err());
                     continue;
diff --git a/niepce-main/src/libraryclient/clientimpl.rs b/niepce-main/src/libraryclient/clientimpl.rs
index a8ca9da..15e33c9 100644
--- a/niepce-main/src/libraryclient/clientimpl.rs
+++ b/niepce-main/src/libraryclient/clientimpl.rs
@@ -114,82 +114,82 @@ impl ClientImpl {
 impl ClientInterface for ClientImpl {
     /// get all the keywords
     fn get_all_keywords(&mut self) {
-        self.schedule_op(move |lib| commands::cmd_list_all_keywords(&lib));
+        self.schedule_op(commands::cmd_list_all_keywords);
     }
 
     fn query_keyword_content(&mut self, keyword_id: LibraryId) {
-        self.schedule_op(move |lib| commands::cmd_query_keyword_content(&lib, keyword_id));
+        self.schedule_op(move |lib| commands::cmd_query_keyword_content(lib, keyword_id));
     }
 
     fn count_keyword(&mut self, id: LibraryId) {
-        self.schedule_op(move |lib| commands::cmd_count_keyword(&lib, id));
+        self.schedule_op(move |lib| commands::cmd_count_keyword(lib, id));
     }
 
     /// get all the folder
     fn get_all_folders(&mut self) {
-        self.schedule_op(move |lib| commands::cmd_list_all_folders(&lib));
+        self.schedule_op(commands::cmd_list_all_folders);
     }
 
     fn query_folder_content(&mut self, folder_id: LibraryId) {
-        self.schedule_op(move |lib| commands::cmd_query_folder_content(&lib, folder_id));
+        self.schedule_op(move |lib| commands::cmd_query_folder_content(lib, folder_id));
     }
 
     fn count_folder(&mut self, folder_id: LibraryId) {
-        self.schedule_op(move |lib| commands::cmd_count_folder(&lib, folder_id));
+        self.schedule_op(move |lib| commands::cmd_count_folder(lib, folder_id));
     }
 
     fn create_folder(&mut self, name: String, path: Option<String>) {
-        self.schedule_op(move |lib| commands::cmd_create_folder(&lib, &name, path.clone()) != 0);
+        self.schedule_op(move |lib| commands::cmd_create_folder(lib, &name, path.clone()) != 0);
     }
 
     fn delete_folder(&mut self, id: LibraryId) {
-        self.schedule_op(move |lib| commands::cmd_delete_folder(&lib, id));
+        self.schedule_op(move |lib| commands::cmd_delete_folder(lib, id));
     }
 
     fn request_metadata(&mut self, file_id: LibraryId) {
-        self.schedule_op(move |lib| commands::cmd_request_metadata(&lib, file_id));
+        self.schedule_op(move |lib| commands::cmd_request_metadata(lib, file_id));
     }
 
     /// set the metadata
     fn set_metadata(&mut self, file_id: LibraryId, meta: Np, value: &PropertyValue) {
         let value2 = value.clone();
-        self.schedule_op(move |lib| commands::cmd_set_metadata(&lib, file_id, meta, &value2));
+        self.schedule_op(move |lib| commands::cmd_set_metadata(lib, file_id, meta, &value2));
     }
     fn write_metadata(&mut self, file_id: LibraryId) {
-        self.schedule_op(move |lib| commands::cmd_write_metadata(&lib, file_id));
+        self.schedule_op(move |lib| commands::cmd_write_metadata(lib, file_id));
     }
 
     fn move_file_to_folder(&mut self, file_id: LibraryId, from: LibraryId, to: LibraryId) {
-        self.schedule_op(move |lib| commands::cmd_move_file_to_folder(&lib, file_id, from, to));
+        self.schedule_op(move |lib| commands::cmd_move_file_to_folder(lib, file_id, from, to));
     }
 
     /// get all the labels
     fn get_all_labels(&mut self) {
-        self.schedule_op(move |lib| commands::cmd_list_all_labels(&lib));
+        self.schedule_op(commands::cmd_list_all_labels);
     }
     fn create_label(&mut self, name: String, colour: String) {
-        self.schedule_op(move |lib| commands::cmd_create_label(&lib, &name, &colour) != 0);
+        self.schedule_op(move |lib| commands::cmd_create_label(lib, &name, &colour) != 0);
     }
     fn delete_label(&mut self, label_id: LibraryId) {
-        self.schedule_op(move |lib| commands::cmd_delete_label(&lib, label_id));
+        self.schedule_op(move |lib| commands::cmd_delete_label(lib, label_id));
     }
     /// update a label
     fn update_label(&mut self, label_id: LibraryId, new_name: String, new_colour: String) {
         self.schedule_op(move |lib| {
-            commands::cmd_update_label(&lib, label_id, &new_name, &new_colour)
+            commands::cmd_update_label(lib, label_id, &new_name, &new_colour)
         });
     }
 
     /// tell to process the Xmp update Queue
     fn process_xmp_update_queue(&mut self, write_xmp: bool) {
-        self.schedule_op(move |lib| commands::cmd_process_xmp_update_queue(&lib, write_xmp));
+        self.schedule_op(move |lib| commands::cmd_process_xmp_update_queue(lib, write_xmp));
     }
 
     /// Import files from a directory
     /// @param dir the directory
     /// @param manage true if imports have to be managed
     fn import_files(&mut self, dir: String, files: Vec<PathBuf>, manage: Managed) {
-        self.schedule_op(move |lib| commands::cmd_import_files(&lib, &dir, &files, manage));
+        self.schedule_op(move |lib| commands::cmd_import_files(lib, &dir, &files, manage));
     }
 }
 
@@ -199,7 +199,7 @@ impl ClientInterfaceSync for ClientImpl {
         let (tx, rx) = mpsc::sync_channel::<LibraryId>(1);
 
         self.schedule_op(move |lib| {
-            tx.send(commands::cmd_create_label(&lib, &name, &colour))
+            tx.send(commands::cmd_create_label(lib, &name, &colour))
                 .unwrap();
             true
         });
@@ -212,7 +212,7 @@ impl ClientInterfaceSync for ClientImpl {
         let (tx, rx) = mpsc::sync_channel::<LibraryId>(1);
 
         self.schedule_op(move |lib| {
-            tx.send(commands::cmd_add_keyword(&lib, &keyword)).unwrap();
+            tx.send(commands::cmd_add_keyword(lib, &keyword)).unwrap();
             true
         });
 
@@ -224,7 +224,7 @@ impl ClientInterfaceSync for ClientImpl {
         let (tx, rx) = mpsc::sync_channel::<LibraryId>(1);
 
         self.schedule_op(move |lib| {
-            tx.send(commands::cmd_create_folder(&lib, &name, path.clone()))
+            tx.send(commands::cmd_create_folder(lib, &name, path.clone()))
                 .unwrap();
             true
         });
diff --git a/niepce-main/src/niepce/ui/image_list_store.rs b/niepce-main/src/niepce/ui/image_list_store.rs
index 364ed4a..f3df080 100644
--- a/niepce-main/src/niepce/ui/image_list_store.rs
+++ b/niepce-main/src/niepce/ui/image_list_store.rs
@@ -208,7 +208,7 @@ impl ImageListStore {
     }
 
     pub fn get_file_id_at_path(&self, path: &gtk4::TreePath) -> LibraryId {
-        if let Some(iter) = self.store.iter(&path) {
+        if let Some(iter) = self.store.iter(path) {
             if let Ok(libfile) = self
                 .store
                 .get_value(&iter, ColIndex::File as i32)
@@ -223,7 +223,7 @@ impl ImageListStore {
     pub fn get_file(&self, id: LibraryId) -> Option<LibFile> {
         if let Some(iter) = self.idmap.get(&id) {
             self.store
-                .get_value(&iter, ColIndex::File as i32)
+                .get_value(iter, ColIndex::File as i32)
                 .get::<&StoreLibFile>()
                 .map(|v| v.0.clone())
                 .ok()
@@ -272,7 +272,7 @@ impl ImageListStore {
     pub fn set_property(&self, iter: &gtk4::TreeIter, change: &MetadataChange) {
         if let Ok(libfile) = self
             .store
-            .get_value(&iter, ColIndex::File as i32)
+            .get_value(iter, ColIndex::File as i32)
             .get::<&StoreLibFile>()
         {
             assert!(libfile.0.id() == change.id);
@@ -281,7 +281,7 @@ impl ImageListStore {
                 let mut file = libfile.0.clone();
                 file.set_property(meta, value);
                 self.store
-                    .set_value(&iter, ColIndex::File as u32, &StoreLibFile(file).to_value());
+                    .set_value(iter, ColIndex::File as u32, &StoreLibFile(file).to_value());
             } else {
                 err_out!("Wrong property type");
             }
diff --git a/niepce-main/src/niepce/ui/library_cell_renderer.rs 
b/niepce-main/src/niepce/ui/library_cell_renderer.rs
index 2209c59..14d0988 100644
--- a/niepce-main/src/niepce/ui/library_cell_renderer.rs
+++ b/niepce-main/src/niepce/ui/library_cell_renderer.rs
@@ -232,7 +232,6 @@ impl LibraryCellRendererPriv {
         cr: &cairo::Context,
         pos: &graphene::Point,
         size: &graphene::Size,
-        r: &Rect,
     ) {
         cr.set_source_rgb(1.0, 1.0, 1.0);
         cr.rectangle(
@@ -519,7 +518,7 @@ impl CellRendererImpl for LibraryCellRendererPriv {
             );
             self.do_draw_thumbnail(snapshot, &thumb_pos, &thumb_size, &pixbuf);
 
-            self.do_draw_thumbnail_frame(&cr, &thumb_pos, &thumb_size, &r);
+            self.do_draw_thumbnail_frame(&cr, &thumb_pos, &thumb_size);
         }
 
         if self.draw_rating.get() {
diff --git a/niepce-main/src/niepce/ui/thumb_strip_view.rs b/niepce-main/src/niepce/ui/thumb_strip_view.rs
index 4a1f818..4e65941 100644
--- a/niepce-main/src/niepce/ui/thumb_strip_view.rs
+++ b/niepce-main/src/niepce/ui/thumb_strip_view.rs
@@ -155,7 +155,7 @@ impl ThumbStripView {
             }
         }
 
-        self.store.replace(model.clone());
+        self.store.replace(model);
         self.setup_model();
     }
 


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