Skip to content

Commit 57184ad

Browse files
committed
refactor(test_runner): replace lazy_static! with std::sync::LazyLock
1 parent b6de1c0 commit 57184ad

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

Cargo.lock

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

src/r3_test_runner/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ futures-core = { version = "0.3.5" }
1616
probe-rs-rtt = { version = "0.12.0" }
1717
tokio-serial = { version = "5.4.1" }
1818
async-mutex = { version = "1.4.0" }
19-
lazy_static = { version = "1.4.0" }
2019
env_logger = { version = "0.8.4" }
2120
serde_json = { version = "1.0.57" }
2221
serialport = { version = "4.0.0" }

src/r3_test_runner/src/main.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![feature(must_not_suspend)] // `must_not_suspend` lint
44
#![feature(lint_reasons)]
55
#![feature(decl_macro)] // `macro`
6+
#![feature(once_cell)]
67
#![feature(pin_macro)] // `core::pin::pin!`
78
#![warn(must_not_suspend)]
89
use anyhow::{bail, Context};
@@ -98,13 +99,13 @@ struct OptTarget {
9899

99100
impl clap::ValueEnum for OptTarget {
100101
fn value_variants<'a>() -> &'a [Self] {
101-
lazy_static::lazy_static! {
102-
static ref VARIANTS: Vec<OptTarget> =
103-
targets::TARGETS
104-
.iter()
105-
.map(|&(name, target)| OptTarget { name, target })
106-
.collect();
107-
}
102+
use std::sync::LazyLock;
103+
static VARIANTS: LazyLock<Vec<OptTarget>> = LazyLock::new(|| {
104+
targets::TARGETS
105+
.iter()
106+
.map(|&(name, target)| OptTarget { name, target })
107+
.collect()
108+
});
108109

109110
&VARIANTS
110111
}

0 commit comments

Comments
 (0)