[niepce] npc-fwk: Remove lazy_static as we use once_cell



commit d0f3b96649bcb2161e4333f4bcc9e568fec0897b
Author: Hubert Figuière <hub figuiere net>
Date:   Sun Jan 12 23:18:58 2020 -0500

    npc-fwk: Remove lazy_static as we use once_cell

 Cargo.lock                        |  1 -
 crates/npc-fwk/Cargo.toml         |  1 -
 crates/npc-fwk/src/lib.rs         |  2 --
 crates/npc-fwk/src/utils/exiv2.rs | 15 ++++++++-------
 4 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index c7b84ca..acf3f4a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -621,7 +621,6 @@ dependencies = [
  "gio-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "glib 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "glib-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
  "multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "once_cell 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/crates/npc-fwk/Cargo.toml b/crates/npc-fwk/Cargo.toml
index be48945..d9a296a 100644
--- a/crates/npc-fwk/Cargo.toml
+++ b/crates/npc-fwk/Cargo.toml
@@ -17,7 +17,6 @@ glib-sys = "*"
 glib = { version = "^0.9.0" }
 gdk = "^0.12.0"
 gdk-pixbuf = "0.8.0"
-lazy_static = "^1.2.0"
 libc = "0.2.39"
 multimap = "0.4.0"
 once_cell = "^0"
diff --git a/crates/npc-fwk/src/lib.rs b/crates/npc-fwk/src/lib.rs
index a226c79..b474b88 100644
--- a/crates/npc-fwk/src/lib.rs
+++ b/crates/npc-fwk/src/lib.rs
@@ -25,8 +25,6 @@ extern crate gio;
 extern crate gio_sys;
 extern crate glib;
 extern crate glib_sys;
-#[macro_use]
-extern crate lazy_static;
 extern crate libc;
 extern crate multimap;
 extern crate once_cell;
diff --git a/crates/npc-fwk/src/utils/exiv2.rs b/crates/npc-fwk/src/utils/exiv2.rs
index 941e26c..c4ddd12 100644
--- a/crates/npc-fwk/src/utils/exiv2.rs
+++ b/crates/npc-fwk/src/utils/exiv2.rs
@@ -20,6 +20,8 @@
 use multimap::MultiMap;
 use std::ffi::OsStr;
 
+use once_cell::unsync::Lazy;
+
 use exempi;
 use rexiv2;
 
@@ -53,8 +55,8 @@ enum Converted {
     Flash(Flash),
 }
 
-lazy_static! {
-    static ref EXIV2_TO_XMP: MultiMap<&'static str, (&'static str, &'static str, Conversion)> = {
+const EXIV2_TO_XMP: Lazy<MultiMap<&'static str, (&'static str, &'static str, Conversion)>> =
+    Lazy::new(|| {
         [
             (
                 "Exif.Image.DateTime",
@@ -227,11 +229,10 @@ lazy_static! {
                 (NS_EXIF_EX, "LensModel", Conversion::Interpreted),
             ),
         ]
-            .iter()
-            .cloned()
-            .collect()
-    };
-}
+        .iter()
+        .cloned()
+        .collect()
+    });
 
 fn convert(conversion: Conversion, value: &str) -> Converted {
     match conversion {


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