Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion proptest-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Mazdak Farrokhzad <[email protected]>"]
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"
Expand Down
5 changes: 2 additions & 3 deletions proptest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand All @@ -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"]
Expand Down Expand Up @@ -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 }
Expand Down
4 changes: 0 additions & 4 deletions proptest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 5 additions & 7 deletions proptest/src/test_runner/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Config> = 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)]
Expand Down
55 changes: 24 additions & 31 deletions proptest/src/test_runner/failure_persistence/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<TestPaths> = 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() {
Expand Down Expand Up @@ -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<PathBuf> = std::sync::LazyLock::new(|| TEST_RUNNER_PATH.iter().collect());
const CARGO_DIR: &str = env!("CARGO_MANIFEST_DIR");

let expected = ::std::iter::once(CARGO_DIR)
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand Down
Loading