diff --git a/Cargo.toml b/Cargo.toml index 1f8e0210..ca4ffb62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ compiletest_rs = "0.11" convert_case = "0.6" criterion = "0.5" insta = "1" -lazy_static = "1.2" message-io = { version = "0.19.0", default-features = false, features = [ "tcp", "udp", diff --git a/proptest-derive/Cargo.toml b/proptest-derive/Cargo.toml index 20ee73e7..fa961087 100644 --- a/proptest-derive/Cargo.toml +++ b/proptest-derive/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Mazdak Farrokhzad "] license = "MIT OR Apache-2.0" readme = "README.md" edition = "2021" -rust-version = "1.74" +rust-version = "1.80" repository = "https://github.com/proptest-rs/proptest" documentation = "https://proptest-rs.github.io/proptest/proptest-derive/index.html" diff --git a/proptest/Cargo.toml b/proptest/Cargo.toml index a3a00318..b77c8def 100644 --- a/proptest/Cargo.toml +++ b/proptest/Cargo.toml @@ -10,7 +10,7 @@ documentation = "https://docs.rs/proptest/latest/proptest/" keywords = ["property", "testing", "quickcheck", "fuzz", "hypothesis"] categories = ["development-tools::testing"] edition = "2021" -rust-version = "1.74" +rust-version = "1.80" exclude = ["/gen-*.sh", "/readme-*.md"] description = """ @@ -29,7 +29,7 @@ attr-macro = ["proptest-macro"] unstable = [] # Enables the use of standard-library dependent features -std = ["rand/std", "rand/os_rng", "lazy_static", "regex-syntax", "num-traits/std"] +std = ["rand/std", "rand/os_rng", "regex-syntax", "num-traits/std"] # std or libm required for mul_add. no_std = ["num-traits/libm"] @@ -66,7 +66,6 @@ handle-panics = ["std"] bitflags = { workspace = true } unarray = { workspace = true } proptest-macro = { workspace = true, optional = true } -lazy_static = { workspace = true, optional = true } num-traits = { workspace = true } regex-syntax = { workspace = true, optional = true } bit-set = { workspace = true, optional = true } diff --git a/proptest/src/lib.rs b/proptest/src/lib.rs index 980b8a6e..d788a71f 100644 --- a/proptest/src/lib.rs +++ b/proptest/src/lib.rs @@ -50,10 +50,6 @@ extern crate bitflags; #[cfg(feature = "bit-set")] extern crate bit_set; -#[cfg(feature = "std")] -#[macro_use] -extern crate lazy_static; - #[cfg(feature = "fork")] #[macro_use] extern crate rusty_fork; diff --git a/proptest/src/test_runner/config.rs b/proptest/src/test_runner/config.rs index 341af2dd..447440ad 100644 --- a/proptest/src/test_runner/config.rs +++ b/proptest/src/test_runner/config.rs @@ -188,13 +188,11 @@ fn default_default_config() -> Config { // The default config, computed by combining environment variables and // defaults. #[cfg(feature = "std")] -lazy_static! { - static ref DEFAULT_CONFIG: Config = { - let mut default_config = default_default_config(); - default_config.failure_persistence = Some(Box::new(crate::test_runner::FileFailurePersistence::default())); - contextualize_config(default_config) - }; -} +static DEFAULT_CONFIG: std::sync::LazyLock = std::sync::LazyLock::new(|| { + let mut default_config = default_default_config(); + default_config.failure_persistence = Some(Box::new(crate::test_runner::FileFailurePersistence::default())); + contextualize_config(default_config) +}); /// The seed for the RNG, can either be random or specified as a u64. #[derive(Debug, Clone, Copy, PartialEq)] diff --git a/proptest/src/test_runner/failure_persistence/file.rs b/proptest/src/test_runner/failure_persistence/file.rs index 21799adb..721f8cb8 100644 --- a/proptest/src/test_runner/failure_persistence/file.rs +++ b/proptest/src/test_runner/failure_persistence/file.rs @@ -402,15 +402,13 @@ impl FileFailurePersistence { } } -lazy_static! { - /// Used to guard access to the persistence file(s) so that a single - /// process will not step on its own toes. - /// - /// We don't have much protecting us should two separate process try to - /// write to the same file at once (depending on how atomic append mode is - /// on the OS), but this should be extremely rare. - static ref PERSISTENCE_LOCK: RwLock<()> = RwLock::new(()); -} +/// Used to guard access to the persistence file(s) so that a single +/// process will not step on its own toes. +/// +/// We don't have much protecting us should two separate process try to +/// write to the same file at once (depending on how atomic append mode is +/// on the OS), but this should be extremely rare. +static PERSISTENCE_LOCK: RwLock<()> = RwLock::new(()); #[cfg(test)] mod tests { @@ -423,22 +421,20 @@ mod tests { misplaced_file: PathBuf, } - lazy_static! { - static ref TEST_PATHS: TestPaths = { - let crate_root = Path::new(env!("CARGO_MANIFEST_DIR")); - let lib_root = crate_root.join("src"); - let src_subdir = lib_root.join("strategy"); - let src_file = lib_root.join("foo.rs"); - let subdir_file = src_subdir.join("foo.rs"); - let misplaced_file = crate_root.join("foo.rs"); - TestPaths { - crate_root, - src_file, - subdir_file, - misplaced_file, - } - }; - } + static TEST_PATHS: std::sync::LazyLock = std::sync::LazyLock::new(|| { + let crate_root = Path::new(env!("CARGO_MANIFEST_DIR")); + let lib_root = crate_root.join("src"); + let src_subdir = lib_root.join("strategy"); + let src_file = lib_root.join("foo.rs"); + let subdir_file = src_subdir.join("foo.rs"); + let misplaced_file = crate_root.join("foo.rs"); + TestPaths { + crate_root, + src_file, + subdir_file, + misplaced_file, + } + }); #[test] fn persistence_file_location_resolved_correctly() { @@ -502,10 +498,7 @@ mod tests { #[test] fn relative_source_files_absolutified() { const TEST_RUNNER_PATH: &[&str] = &["src", "test_runner", "mod.rs"]; - lazy_static! { - static ref TEST_RUNNER_RELATIVE: PathBuf = - TEST_RUNNER_PATH.iter().collect(); - } + static TEST_RUNNER_RELATIVE: std::sync::LazyLock = std::sync::LazyLock::new(|| TEST_RUNNER_PATH.iter().collect()); const CARGO_DIR: &str = env!("CARGO_MANIFEST_DIR"); let expected = ::std::iter::once(CARGO_DIR) @@ -517,7 +510,7 @@ mod tests { &*expected, absolutize_source_file_with_cwd( || Ok(Path::new(CARGO_DIR).to_owned()), - &TEST_RUNNER_RELATIVE + &*TEST_RUNNER_RELATIVE ) .unwrap() ); @@ -527,7 +520,7 @@ mod tests { &*expected, absolutize_source_file_with_cwd( || Ok(Path::new(CARGO_DIR).join("target")), - &TEST_RUNNER_RELATIVE + &*TEST_RUNNER_RELATIVE ) .unwrap() );