[niepce] rust: fix a few clippy warnings



commit 8b46110a8e0ca9d43b328fb613b4a1428c3116f2
Author: Hubert Figuière <hub figuiere net>
Date:   Sun Feb 28 17:02:01 2021 -0500

    rust: fix a few clippy warnings

 crates/npc-fwk/src/base/propertybag.rs  | 6 ++++++
 crates/npc-fwk/src/toolkit/gdk_utils.rs | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/crates/npc-fwk/src/base/propertybag.rs b/crates/npc-fwk/src/base/propertybag.rs
index f036c38..e5ccf92 100644
--- a/crates/npc-fwk/src/base/propertybag.rs
+++ b/crates/npc-fwk/src/base/propertybag.rs
@@ -26,6 +26,12 @@ pub struct PropertyBag<Index> {
     pub map: BTreeMap<Index, PropertyValue>,
 }
 
+impl<Index: Ord + Copy> Default for PropertyBag<Index> {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
 impl<Index: Ord + Copy> PropertyBag<Index> {
     pub fn new() -> Self {
         Self {
diff --git a/crates/npc-fwk/src/toolkit/gdk_utils.rs b/crates/npc-fwk/src/toolkit/gdk_utils.rs
index 5280dd5..12cc8bc 100644
--- a/crates/npc-fwk/src/toolkit/gdk_utils.rs
+++ b/crates/npc-fwk/src/toolkit/gdk_utils.rs
@@ -22,6 +22,7 @@ use std::path::Path;
 
 use gdk_pixbuf::prelude::*;
 use libopenraw_rs as or;
+use libopenraw_rs::DataType;
 
 /// Scale the pixbuf to fit in a square of %dim pixels
 pub fn gdkpixbuf_scale_to_fit(
@@ -72,7 +73,7 @@ fn thumbnail_to_pixbuf(thumbnail: &or::Thumbnail, orientation: i32) -> Option<gd
     let buf = thumbnail.get_data().ok()?;
 
     let pixbuf = match format {
-        or::DataType::Pixmap8Rgb => {
+        DataType::Pixmap8Rgb => {
             let (x, y) = thumbnail.get_dimensions();
 
             let bytes = glib::Bytes::from(buf);
@@ -86,7 +87,7 @@ fn thumbnail_to_pixbuf(thumbnail: &or::Thumbnail, orientation: i32) -> Option<gd
                 x as i32 * 3,
             ))
         }
-        or::DataType::Jpeg | or::DataType::Tiff | or::DataType::Png => {
+        DataType::Jpeg | DataType::Tiff | DataType::Png => {
             let loader = gdk_pixbuf::PixbufLoader::new();
 
             if let Err(err) = loader.write(&buf) {


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