From d605a84c8acb90ea7ea4931710691ea5680da6b3 Mon Sep 17 00:00:00 2001 From: baoyachi Date: Wed, 14 Dec 2022 18:02:19 +0800 Subject: [PATCH 1/2] fix clippy warning, format github action ci --- .github/dependabot.yml | 28 ++++++++++++++-------------- .github/workflows/check.yml | 8 +++++--- Cargo.toml | 2 +- example_shadow/src/main.rs | 2 +- example_shadow_hook/build.rs | 4 ++-- src/lib.rs | 4 ++-- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 31291ef..8ea4b20 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,16 +1,16 @@ version: 2 updates: -- package-ecosystem: cargo - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 10 - labels: - - "\U0001F4E6 dependencies" -- package-ecosystem: github-actions - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 10 - labels: - - "\U0001F4E6 dependencies" + - package-ecosystem: cargo + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + labels: + - "\U0001F4E6 dependencies" + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + labels: + - "\U0001F4E6 dependencies" diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5186ef0..512410b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -68,12 +68,14 @@ jobs: toolchain: nightly override: true - name: Build on nightly - run: cargo build --release + run: | + cargo build --release + cargo +nightly clippy --all --all-features -- -D warnings test: strategy: matrix: - rust: [stable, beta, nightly] + rust: [ stable, beta, nightly ] runs-on: ubuntu-latest steps: - name: Setup Rust @@ -105,7 +107,7 @@ jobs: publish-crate: if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest - needs: [test] + needs: [ test ] steps: - name: Set up Rust uses: hecrj/setup-rust-action@v1 diff --git a/Cargo.toml b/Cargo.toml index 66390cb..1acc094 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shadow-rs" -version = "0.18.0" +version = "0.19.0" authors = ["baoyachi "] edition = "2021" description = "A build-time information stored in your rust project" diff --git a/example_shadow/src/main.rs b/example_shadow/src/main.rs index 0e244de..c5accf0 100644 --- a/example_shadow/src/main.rs +++ b/example_shadow/src/main.rs @@ -6,7 +6,7 @@ shadow!(build); fn main() { let local_time = shadow_rs::DateTime::now().human_format(); - println!("{}", local_time); + println!("{local_time}"); Command::new("example_shadow") .version(build::CLAP_LONG_VERSION) diff --git a/example_shadow_hook/build.rs b/example_shadow_hook/build.rs index 7bb8c83..86f4ae8 100644 --- a/example_shadow_hook/build.rs +++ b/example_shadow_hook/build.rs @@ -14,7 +14,7 @@ fn hook(file: &File) -> SdResult<()> { fn append_write_const(mut file: &File) -> SdResult<()> { let hook_const: &str = r#"pub const HOOK_CONST: &str = "hello hook const";"#; - writeln!(file, "{}", hook_const)?; + writeln!(file, "{hook_const}")?; Ok(()) } @@ -23,6 +23,6 @@ fn append_write_fn(mut file: &File) -> SdResult<()> { pub fn hook_fn() -> &'static str{ "hello hook bar fn" }"#; - writeln!(file, "{}", hook_fn)?; + writeln!(file, "{hook_fn}")?; Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index 2fc146d..87920ac 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -445,13 +445,13 @@ impl Shadow { // append gen const for k in self.map.keys() { - let tmp = format!(r#"{}println!("{}:{{}}", {});{}"#, "\t", k, k, "\n"); + let tmp = format!(r#"{}println!("{k}:{k}");{}"#, "\t", "\n"); print_val.push_str(tmp.as_str()); } // append gen fn for k in gen_const { - let tmp = format!(r#"{}println!("{}:{{}}\n", {});{}"#, "\t", k, k, "\n"); + let tmp = format!(r#"{}println!("{k}:{k}\n");{}"#, "\t", "\n"); print_val.push_str(tmp.as_str()); } From 3bcbd4aac0cea968e56a0713c8592591f1d2c2d8 Mon Sep 17 00:00:00 2001 From: baoyachi Date: Wed, 14 Dec 2022 18:13:51 +0800 Subject: [PATCH 2/2] fix github action ci --- .github/workflows/check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 512410b..d2eb6cd 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -67,6 +67,7 @@ jobs: with: toolchain: nightly override: true + components: clippy - name: Build on nightly run: | cargo build --release