Skip to content

Commit f88d627

Browse files
authored
Fixed lint issues (#404)
* Fixed lint issues * rustfmt
1 parent a16f7d1 commit f88d627

File tree

6 files changed

+23
-24
lines changed

6 files changed

+23
-24
lines changed

test_util/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ gix = { version = "0.70.0", default-features = false, features = [
3535
"worktree-mutation",
3636
"blocking-network-client",
3737
], optional = true}
38-
lazy_static = "1.5.0"
3938
rand = { version = "0.8.5", optional = true }
4039
temp-env = "0.3.6"
4140

test_util/src/utils.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
use std::sync::LazyLock;
2+
13
use anyhow::Result;
2-
use lazy_static::lazy_static;
34
use temp_env::with_vars;
45

5-
lazy_static! {
6-
static ref DEFAULT_KVS: Vec<(&'static str, Option<&'static str>)> = vec![
6+
static DEFAULT_KVS: LazyLock<Vec<(&'static str, Option<&'static str>)>> = LazyLock::new(|| {
7+
vec![
78
("CARGO_FEATURE_BUILD", Some("build")),
89
("CARGO_FEATURE_GIT", Some("git")),
910
("DEBUG", Some("true")),
1011
("OPT_LEVEL", Some("1")),
1112
("TARGET", Some("x86_64-unknown-linux-gnu")),
12-
];
13-
}
13+
]
14+
});
1415

1516
/// Wrap a closure with cargo environment variables to use within a test
1617
///

vergen-pretty/Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ always_include = ["__vergen_empty_test", "unstable"]
3232
[features]
3333
default = []
3434
unstable = ["vergen-gix/unstable"]
35-
color = ["console", "lazy_static"]
35+
color = ["console"]
3636
header = ["console", "rand"]
3737
trace = ["tracing"]
3838
__vergen_test = ["vergen-gix", "vergen-gix/unstable"]
@@ -43,7 +43,6 @@ anyhow = "1.0.95"
4343
console = { version = "0.15.10", optional = true }
4444
convert_case = "0.7.1"
4545
derive_builder = "0.20.2"
46-
lazy_static = { version = "1.5.0", optional = true }
4746
rand = { version = "0.8.5", optional = true }
4847
serde = { version = "1.0.217", features = ["derive"], optional = true }
4948
tracing = { version = "0.1.41", features = [
@@ -62,7 +61,6 @@ vergen-gix = { version = "1.0.7", path = "../vergen-gix", features = [
6261
], optional = true }
6362

6463
[dev-dependencies]
65-
lazy_static = "1.5.0"
6664
regex = "1.11.1"
6765
serde_json = "1.0.137"
6866
tracing-subscriber = { version = "0.3.19", features = ["fmt"] }

vergen-pretty/src/header/mod.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,11 @@ mod test {
245245
use anyhow::Result;
246246
#[cfg(feature = "color")]
247247
use console::Style;
248-
use lazy_static::lazy_static;
248+
#[cfg(feature = "__vergen_test")]
249249
use regex::Regex;
250250
use std::io::Write;
251+
#[cfg(feature = "__vergen_test")]
252+
use std::sync::LazyLock;
251253

252254
#[cfg(feature = "__vergen_test")]
253255
const HEADER_PREFIX: &str = r"██████╗ ██╗ ██╗██████╗ ██╗ ██╗
@@ -265,11 +267,15 @@ mod test {
265267
4a61736f6e204f7a696173
266268
";
267269

268-
lazy_static! {
269-
static ref BUILD_TIMESTAMP: Regex = Regex::new(r"Timestamp \( build\)").unwrap();
270-
static ref BUILD_SEMVER: Regex = Regex::new(r"Semver \( rustc\)").unwrap();
271-
static ref GIT_BRANCH: Regex = Regex::new(r"Branch \( git\)").unwrap();
272-
}
270+
#[cfg(feature = "__vergen_test")]
271+
static BUILD_TIMESTAMP: LazyLock<Regex> =
272+
LazyLock::new(|| Regex::new(r"Timestamp \( build\)").unwrap());
273+
#[cfg(feature = "__vergen_test")]
274+
static BUILD_SEMVER: LazyLock<Regex> =
275+
LazyLock::new(|| Regex::new(r"Semver \( rustc\)").unwrap());
276+
#[cfg(feature = "__vergen_test")]
277+
static GIT_BRANCH: LazyLock<Regex> =
278+
LazyLock::new(|| Regex::new(r"Branch \( git\)").unwrap());
273279

274280
#[test]
275281
#[allow(clippy::clone_on_copy, clippy::redundant_clone)]

vergen-pretty/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,9 @@ pub use pretty::PrettyBuilderError;
330330
#[doc(inline)]
331331
pub use tracing::Level;
332332

333-
#[cfg(all(test, not(feature = "header")))]
334-
use lazy_static as _;
335333
#[cfg(all(feature = "header", not(feature = "color")))]
336334
use rand as _;
337-
#[cfg(all(test, not(feature = "header")))]
335+
#[cfg(test)]
338336
use regex as _;
339337
#[cfg(all(test, not(feature = "serde")))]
340338
use serde_json as _;

vergen-pretty/src/pretty/feature/color.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@
99
use crate::{pretty::Pretty, Prefix, Suffix};
1010
use anyhow::Result;
1111
use console::Style;
12-
use lazy_static::lazy_static;
13-
use std::io::Write;
12+
use std::{io::Write, sync::LazyLock};
1413

15-
lazy_static! {
16-
pub(crate) static ref BOLD_BLUE: Style = Style::new().bold().blue();
17-
pub(crate) static ref BOLD_GREEN: Style = Style::new().bold().green();
18-
}
14+
pub(crate) static BOLD_BLUE: LazyLock<Style> = LazyLock::new(|| Style::new().bold().blue());
15+
pub(crate) static BOLD_GREEN: LazyLock<Style> = LazyLock::new(|| Style::new().bold().green());
1916

2017
impl Pretty {
2118
#[cfg_attr(docsrs, doc(cfg(feature = "color")))]

0 commit comments

Comments
 (0)