From 4a2528a8287c5dad171a354c166716312849b74d Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:10:04 +0200 Subject: [PATCH] chore(deps): replace `once_cell` with `std::sync` --- Cargo.lock | 1 - Cargo.toml | 2 +- clippy.toml | 1 + src/lib.rs | 18 +++++++++--------- src/utils.rs | 7 +++---- 5 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 clippy.toml diff --git a/Cargo.lock b/Cargo.lock index 837be3f..cdc13c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1638,7 +1638,6 @@ dependencies = [ "futures", "ignore", "mockito", - "once_cell", "rand", "regex", "reqwest", diff --git a/Cargo.toml b/Cargo.toml index 3048cd3..266f317 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ name = "soldeer" readme = "./README.md" repository = "https://github.com/mario-eth/soldeer" version = "0.3.0" +rust-version = "1.80" [dependencies] chrono = { version = "0.4.38", default-features = false, features = [ @@ -22,7 +23,6 @@ const-hex = "1.12.0" email-address-parser = "2.0.0" futures = "0.3.30" ignore = { version = "0.4.22", features = ["simd-accel"] } -once_cell = "1.19" regex = "1.10.5" reqwest = { version = "0.12.5", features = [ "blocking", diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000..8bfc90f --- /dev/null +++ b/clippy.toml @@ -0,0 +1 @@ +msrv = "1.80" diff --git a/src/lib.rs b/src/lib.rs index ec2cb60..2f94b6a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,9 +19,8 @@ use config::{ use dependency_downloader::download_dependency; use janitor::cleanup_dependency; use lock::LockWriteMode; -use once_cell::sync::Lazy; use remote::get_latest_forge_std_dependency; -use std::{env, path::PathBuf}; +use std::{env, path::PathBuf, sync::LazyLock}; use utils::{get_url_type, UrlType}; use versioning::validate_name; use yansi::Paint as _; @@ -37,13 +36,14 @@ mod remote; mod utils; mod versioning; -pub static DEPENDENCY_DIR: Lazy = - Lazy::new(|| get_current_working_dir().join("dependencies/")); -pub static LOCK_FILE: Lazy = Lazy::new(|| get_current_working_dir().join("soldeer.lock")); -pub static SOLDEER_CONFIG_FILE: Lazy = - Lazy::new(|| get_current_working_dir().join("soldeer.toml")); -pub static FOUNDRY_CONFIG_FILE: Lazy = - Lazy::new(|| get_current_working_dir().join("foundry.toml")); +pub static DEPENDENCY_DIR: LazyLock = + LazyLock::new(|| get_current_working_dir().join("dependencies/")); +pub static LOCK_FILE: LazyLock = + LazyLock::new(|| get_current_working_dir().join("soldeer.lock")); +pub static SOLDEER_CONFIG_FILE: LazyLock = + LazyLock::new(|| get_current_working_dir().join("soldeer.toml")); +pub static FOUNDRY_CONFIG_FILE: LazyLock = + LazyLock::new(|| get_current_working_dir().join("foundry.toml")); #[tokio::main] pub async fn run(command: Subcommands) -> Result<(), SoldeerError> { diff --git a/src/utils.rs b/src/utils.rs index 35d0780..7488157 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -2,7 +2,6 @@ use crate::{ config::HttpDependency, dependency_downloader::IntegrityChecksum, errors::DownloadError, }; use ignore::{WalkBuilder, WalkState}; -use once_cell::sync::Lazy; use regex::Regex; use sha2::{Digest, Sha256}; use simple_home_dir::home_dir; @@ -14,15 +13,15 @@ use std::{ path::{Path, PathBuf}, sync::{ atomic::{AtomicBool, Ordering}, - Arc, Mutex, + Arc, LazyLock, Mutex, }, }; use yansi::Paint as _; -static GIT_SSH_REGEX: Lazy = Lazy::new(|| { +static GIT_SSH_REGEX: LazyLock = LazyLock::new(|| { Regex::new(r"^(?:git@github\.com|git@gitlab)").expect("git ssh regex should compile") }); -static GIT_HTTPS_REGEX: Lazy = Lazy::new(|| { +static GIT_HTTPS_REGEX: LazyLock = LazyLock::new(|| { Regex::new(r"^(?:https://github\.com|https://gitlab\.com).*\.git$") .expect("git https regex should compile") });