From 1130ba7961bc31574b07c4594a024392ce508f87 Mon Sep 17 00:00:00 2001 From: Cameron Hart Date: Sat, 6 Jun 2026 12:51:21 +1200 Subject: [PATCH] Fix clippy warnings in tests. --- .github/workflows/ci.yml | 10 +++++++++- tests/lib.rs | 14 +++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36fc0ee..a857c68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,12 +15,20 @@ jobs: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + + - run: rustup update --no-self-update stable + - run: rustup default stable + - name: fmt run: cargo fmt -- --check --color always + - name: clippy - run: cargo clippy --no-deps + run: cargo clippy --no-deps --all-targets -- -D warnings + - name: check run: cargo check + - name: test run: cargo test diff --git a/tests/lib.rs b/tests/lib.rs index 13845be..70ab743 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -30,7 +30,7 @@ fn setup_test_dir() -> Result { // Initialize git repo (codegen requires a git repository) Command::new("git") - .args(&["init"]) + .args(["init"]) .current_dir(dir.path()) .assert() .success(); @@ -83,7 +83,7 @@ fn test_generate_files() -> Result<()> { // Run codegen binary directly with --config flag let mut cmd = Command::cargo_bin("codegen")?; - cmd.args(&["--config", config_path.to_str().unwrap()]); + cmd.args(["--config", config_path.to_str().unwrap()]); cmd.assert().success(); @@ -111,12 +111,12 @@ fn test_check_mode() -> Result<()> { // First generate the file let mut cmd = Command::cargo_bin("codegen")?; - cmd.args(&["--config", config_path.to_str().unwrap()]); + cmd.args(["--config", config_path.to_str().unwrap()]); cmd.assert().success(); // Run codegen in check mode with matching files let mut cmd = Command::cargo_bin("codegen")?; - cmd.args(&["--config", config_path.to_str().unwrap(), "--check"]); + cmd.args(["--config", config_path.to_str().unwrap(), "--check"]); cmd.assert().success(); // Now modify the generated file to have different content @@ -125,7 +125,7 @@ fn test_check_mode() -> Result<()> { // Run codegen in check mode let mut cmd = Command::cargo_bin("codegen")?; - cmd.args(&["--config", config_path.to_str().unwrap(), "--check"]); + cmd.args(["--config", config_path.to_str().unwrap(), "--check"]); cmd.assert().failure(); @@ -171,7 +171,7 @@ fn test_multiple_templates() -> Result<()> { // Run codegen and check that all files are generated let mut cmd = Command::cargo_bin("codegen")?; - cmd.args(&["--config", config_path.to_str().unwrap()]); + cmd.args(["--config", config_path.to_str().unwrap()]); cmd.assert().success(); assert_snapshot!(std::fs::read_to_string( @@ -210,7 +210,7 @@ fn test_error_missing_properties() -> Result<()> { // Run codegen and check that it fails with an error let mut cmd = Command::cargo_bin("codegen")?; - cmd.args(&["--config", config_path.to_str().unwrap()]); + cmd.args(["--config", config_path.to_str().unwrap()]); cmd.assert().failure();