Skip to content

Commit a580dcd

Browse files
committed
test runner: use std::sync::LazyLock instead of once_cell
1 parent c9b06a5 commit a580dcd

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

tests/Cargo.lock

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ get_unwrap = "warn"
1616
clap = { version = "4.5.4", features = ["derive"] }
1717
ctrlc = "3.4.4"
1818
fancy-regex = "0.13.0"
19-
once_cell = "1.19.0"
2019
rand = "0.8.5"
2120
rayon = "1.10.0"
2221
serde = { version = "1.0.199", features = ["derive"] }

tests/src/common.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use once_cell::sync::Lazy;
21
use std::{
32
env,
43
ffi::OsString,
@@ -9,14 +8,14 @@ use std::{
98
process::{Command, Stdio},
109
sync::{
1110
atomic::{AtomicBool, Ordering::Relaxed},
12-
Arc,
11+
Arc, LazyLock,
1312
},
1413
time::Duration,
1514
};
1615
pub use tempfile::tempdir;
1716
use wait_timeout::ChildExt;
1817

19-
pub static VIM_BIN: Lazy<OsString> = Lazy::new(|| {
18+
pub static VIM_BIN: LazyLock<OsString> = LazyLock::new(|| {
2019
let default_vim = OsString::from("vim");
2120
let v = env::var_os("TEST_VIM").unwrap_or(default_vim.clone());
2221
if v.is_empty() {
@@ -25,15 +24,15 @@ pub static VIM_BIN: Lazy<OsString> = Lazy::new(|| {
2524
v
2625
}
2726
});
28-
static TEST_NVIM: Lazy<bool> = Lazy::new(|| {
27+
static TEST_NVIM: LazyLock<bool> = LazyLock::new(|| {
2928
PathBuf::from(&*VIM_BIN)
3029
.file_stem()
3130
.unwrap()
3231
.to_str()
3332
.unwrap()
3433
.contains("nvim")
3534
});
36-
static VIM_SYMLINK: Lazy<&str> = Lazy::new(|| if *TEST_NVIM { "nvim" } else { ".vim" });
35+
static VIM_SYMLINK: LazyLock<&str> = LazyLock::new(|| if *TEST_NVIM { "nvim" } else { ".vim" });
3736

3837
pub fn clean_dotvim_symlink() {
3938
if fs::metadata(*VIM_SYMLINK).is_ok() {

0 commit comments

Comments
 (0)