diff --git a/Cargo.lock b/Cargo.lock index 84e4507..6fd8cc3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,7 +280,6 @@ dependencies = [ "gtk4", "hex", "image", - "lazy_static", "libhandy4", "log", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index 7c96e50..b67c17a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ futures = "0.3" gettext-rs = {version = "0.5", features = ["gettext-system"]} gtk-macros = "0.2" image = "0.23" -lazy_static = "1.4" log = "0.4" pretty_env_logger = "0.4" quick-xml = "0.20" diff --git a/src/main.rs b/src/main.rs index 353ad7d..de30084 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,9 @@ #[macro_use] extern crate log; #[macro_use] -extern crate lazy_static; -#[macro_use] -extern crate diesel_migrations; -#[macro_use] extern crate diesel; #[macro_use] -extern crate glib; -#[macro_use] -extern crate gtk_macros; +extern crate diesel_migrations; use gettextrs::*; mod application; diff --git a/src/models/database.rs b/src/models/database.rs index a608911..9c1a173 100644 --- a/src/models/database.rs +++ b/src/models/database.rs @@ -4,13 +4,12 @@ use diesel::r2d2; use diesel::r2d2::ConnectionManager; use std::path::PathBuf; use std::{fs, fs::File}; +use once_cell::sync::Lazy; type Pool = r2d2::Pool>; -lazy_static! { - static ref DB_PATH: PathBuf = glib::get_user_data_dir().join("authenticator"); - static ref POOL: Pool = init_pool().expect("Failed to create a pool"); -} +static DB_PATH: Lazy = Lazy::new(|| glib::get_user_data_dir().join("authenticator")); +static POOL: Lazy = Lazy::new(|| init_pool().expect("Failed to create a pool")); embed_migrations!("migrations/");