Skip to content

Commit

Permalink
chore: get rid of lazy_static
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenivaya committed Oct 30, 2024
1 parent f8711d3 commit 3303126
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ anyhow = "1.0.91"
toml = "0.8.19"
serde = { version = "1.0.214", features = ["derive"] }
dirs = "5.0.1"
lazy_static = "1.5.0"
clap = { version = "4.5", features = ["derive", "unicode", "wrap_help"] }
sysinfo = "0.32.0"
run_script = "0.11.0"
Expand Down
17 changes: 7 additions & 10 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
use std::fs;
use std::path::PathBuf;
use std::{fs, sync::LazyLock};

use crate::cli::Arguments;
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};

const APP_NAME: &str = env!("CARGO_PKG_NAME");
lazy_static! {
pub static ref CONFIG_FOLDER: PathBuf = {
let mut path = dirs::config_dir().expect("Could not find config directory");
path.extend([APP_NAME]);
path
};
pub static ref CONFIG_FILE: PathBuf = CONFIG_FOLDER.join("config.toml");
}
pub static CONFIG_FOLDER: LazyLock<PathBuf> = LazyLock::new(|| {
let mut path = dirs::config_dir().expect("Could not find config directory");
path.extend([APP_NAME]);
path
});
pub static CONFIG_FILE: LazyLock<PathBuf> = LazyLock::new(|| CONFIG_FOLDER.join("config.toml"));

#[derive(Deserialize, Serialize, Debug)]
pub struct Config {
Expand Down

0 comments on commit 3303126

Please sign in to comment.