diff --git a/cargo-dylint/tests/library_packages.rs b/cargo-dylint/tests/library_packages.rs index 00e416270..56d3b2d6c 100644 --- a/cargo-dylint/tests/library_packages.rs +++ b/cargo-dylint/tests/library_packages.rs @@ -1,7 +1,7 @@ use assert_cmd::prelude::*; use dylint_internal::{env, packaging::isolate, CommandExt}; use predicates::prelude::*; -use std::{env::set_var, fs::OpenOptions, io::Write, sync::Mutex}; +use std::{env::set_var, fs::OpenOptions, io::Write}; use tempfile::tempdir; // smoelius: "Separate lints into categories" commit @@ -12,16 +12,8 @@ fn initialize() { set_var(env::CARGO_TERM_COLOR, "never"); } -// smoelius: The use of multiple revisions by the tests in this file causes problems. Specifically, -// multiple "checkouts" directories are created causing it to appear as though multiple directories -// were accessed. In this regard, `MUTEX` is merely a band-aid. A proper solution would address the -// underlying problem, rather than try to fix the tests themselves. -static MUTEX: Mutex<()> = Mutex::new(()); - #[test] fn array_pattern() { - let _lock = MUTEX.lock().unwrap(); - let assert = std::process::Command::cargo_bin("cargo-dylint") .unwrap() .current_dir("fixtures/array_pattern") @@ -37,8 +29,6 @@ fn array_pattern() { #[test] fn invalid_pattern() { - let _lock = MUTEX.lock().unwrap(); - for pattern in ["/*", "../*"] { let tempdir = tempdir().unwrap(); @@ -87,8 +77,6 @@ libraries = [ #[test] fn library_packages_in_dylint_toml() { - let _lock = MUTEX.lock().unwrap(); - std::process::Command::cargo_bin("cargo-dylint") .unwrap() .current_dir("fixtures/library_packages_in_dylint_toml") @@ -102,8 +90,6 @@ fn library_packages_in_dylint_toml() { #[test] fn list() { - let _lock = MUTEX.lock().unwrap(); - let tempdir = tempdir().unwrap(); dylint_internal::cargo::init("package `list_test`") @@ -140,8 +126,6 @@ pattern = "examples/general/crate_wide_allow" /// Verify that changes to workspace metadata cause the lints to be rerun. #[test] fn metadata_change() { - let _lock = MUTEX.lock().unwrap(); - let tempdir = tempdir().unwrap(); dylint_internal::cargo::init("package `metadata_change_test`") @@ -205,8 +189,6 @@ fn metadata_change() { #[test] fn nonexistent_git_library() { - let _lock = MUTEX.lock().unwrap(); - let tempdir = tempdir().unwrap(); dylint_internal::cargo::init("package `nonexistent_git_library_test`") @@ -259,8 +241,6 @@ pattern = "examples/general/nonexistent_library" #[test] fn nonexistent_path_library() { - let _lock = MUTEX.lock().unwrap(); - let tempdir = tempdir().unwrap(); dylint_internal::cargo::init("package `nonexistent_path_library_test`") @@ -316,8 +296,6 @@ path = "{}/../examples/general/nonexistent_library" /// Verify that changes to `RUSTFLAGS` do not cause workspace metadata entries to be rebuilt. #[test] fn rustflags_change() { - let _lock = MUTEX.lock().unwrap(); - let tempdir = tempdir().unwrap(); dylint_internal::cargo::init("package `rustflags_change_test`") @@ -364,8 +342,6 @@ path = "{}/../examples/general/crate_wide_allow" #[test] fn unknown_keys() { - let _lock = MUTEX.lock().unwrap(); - let tempdir = tempdir().unwrap(); dylint_internal::cargo::init("package `unknown_keys_test`")