From 07150f07eb00e60713377b01bba62dee374d0c10 Mon Sep 17 00:00:00 2001 From: baoyachi Date: Sun, 15 Dec 2024 23:49:22 +0800 Subject: [PATCH] fix cargo clippy check --- src/gen_const.rs | 2 +- src/lib.rs | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gen_const.rs b/src/gen_const.rs index ddb7207..d433da4 100644 --- a/src/gen_const.rs +++ b/src/gen_const.rs @@ -81,7 +81,7 @@ const CLAP_LONG_VERSION_TAG_CONST: (&str, &str) = ( tag:{} commit_hash:{} build_time:{} -build_env:{},{}"#,PKG_VERSION, TAG, SHORT_COMMIT, BUILD_TIME_2822, RUST_VERSION, RUST_CHANNEL +build_env:{},{}"#,PKG_VERSION, TAG, SHORT_COMMIT, BUILD_TIME, RUST_VERSION, RUST_CHANNEL );"##, ); diff --git a/src/lib.rs b/src/lib.rs index ee82b63..30c017c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -686,7 +686,10 @@ mod tests { #[test] fn test_build() -> SdResult<()> { - Shadow::build_with("./".into(), "./".into(), Default::default())?; + ShadowBuilder::builder() + .src_path("./") + .out_path("./") + .build()?; let shadow = fs::read_to_string("./shadow.rs")?; assert!(!shadow.is_empty()); assert!(shadow.lines().count() > 0); @@ -695,13 +698,16 @@ mod tests { #[test] fn test_build_deny() -> SdResult<()> { - let mut deny = BTreeSet::new(); - deny.insert(CARGO_TREE); - Shadow::build_with("./".into(), "./".into(), deny)?; + ShadowBuilder::builder() + .src_path("./") + .out_path("./") + .deny_const(BTreeSet::from([CARGO_TREE])) + .build()?; + let shadow = fs::read_to_string("./shadow.rs")?; assert!(!shadow.is_empty()); assert!(shadow.lines().count() > 0); - println!("{shadow}"); + // println!("{shadow}"); let expect = "pub const CARGO_TREE :&str"; assert!(!shadow.contains(expect)); Ok(())