diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8ca54733c1..fcb15ea156 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -77,7 +77,7 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - - run: cargo clippy --all -- -D warnings + - run: cargo clippy --all-targets --all-features -- -D warnings cargo_test: name: "cargo test" diff --git a/benches/source_code_locator.rs b/benches/source_code_locator.rs index 473ea38578..e2e1359e86 100644 --- a/benches/source_code_locator.rs +++ b/benches/source_code_locator.rs @@ -1,11 +1,11 @@ +use std::fs; use std::path::Path; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use ropey::Rope; -use ruff::fs; fn criterion_benchmark(c: &mut Criterion) { - let contents = fs::read_file(Path::new("resources/test/fixtures/D.py")).unwrap(); + let contents = fs::read_to_string(Path::new("resources/test/fixtures/D.py")).unwrap(); c.bench_function("rope", |b| { b.iter(|| { let rope = Rope::from_str(black_box(&contents)); diff --git a/src/check_lines.rs b/src/check_lines.rs index b4bd94708a..ba61d36934 100644 --- a/src/check_lines.rs +++ b/src/check_lines.rs @@ -283,7 +283,7 @@ mod tests { }, &fixer::Mode::Generate, ); - return checks; + checks }; assert!(!check_with_max_line_length(6).is_empty()); assert!(check_with_max_line_length(7).is_empty()); diff --git a/src/linter.rs b/src/linter.rs index 545116994c..65ef69d03f 100644 --- a/src/linter.rs +++ b/src/linter.rs @@ -517,7 +517,7 @@ mod tests { let snapshot = format!("{}_{}", check_code.as_ref(), path.to_string_lossy()); let mut checks = test_path( Path::new("./resources/test/fixtures").join(path).as_path(), - &settings::Settings::for_rule(check_code.clone()), + &settings::Settings::for_rule(check_code), &fixer::Mode::Generate, )?; checks.sort_by_key(|check| check.location); diff --git a/src/pep8_naming/helpers.rs b/src/pep8_naming/helpers.rs index 36bf664a7e..f868bb1402 100644 --- a/src/pep8_naming/helpers.rs +++ b/src/pep8_naming/helpers.rs @@ -83,7 +83,7 @@ mod tests { use crate::pep8_naming::helpers::{is_acronym, is_camelcase, is_mixed_case}; #[test] - fn test_is_camelcase() -> () { + fn test_is_camelcase() { assert!(is_camelcase("Camel")); assert!(is_camelcase("CamelCase")); assert!(!is_camelcase("camel")); @@ -93,7 +93,7 @@ mod tests { } #[test] - fn test_is_mixed_case() -> () { + fn test_is_mixed_case() { assert!(is_mixed_case("mixedCase")); assert!(is_mixed_case("mixed_Case")); assert!(is_mixed_case("_mixed_Case")); @@ -104,7 +104,7 @@ mod tests { } #[test] - fn test_is_acronym() -> () { + fn test_is_acronym() { assert!(is_acronym("AB", "AB")); assert!(is_acronym("AbcDef", "AD")); assert!(!is_acronym("AbcDef", "Ad")); diff --git a/src/python/string.rs b/src/python/string.rs index 50be2861da..e508102e26 100644 --- a/src/python/string.rs +++ b/src/python/string.rs @@ -27,7 +27,7 @@ mod tests { use crate::python::string::{is_lower, is_upper}; #[test] - fn test_is_lower() -> () { + fn test_is_lower() { assert!(is_lower("abc")); assert!(is_lower("a_b_c")); assert!(is_lower("a2c")); @@ -38,7 +38,7 @@ mod tests { } #[test] - fn test_is_upper() -> () { + fn test_is_upper() { assert!(is_upper("ABC")); assert!(is_upper("A_B_C")); assert!(is_upper("A2C")); diff --git a/tests/integration_test.rs b/tests/integration_test.rs index c2abaa09a9..086fa992be 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -6,7 +6,7 @@ use assert_cmd::{crate_name, Command}; #[test] fn test_stdin_success() -> Result<()> { let mut cmd = Command::cargo_bin(crate_name!())?; - cmd.args(&["-"]).write_stdin("").assert().success(); + cmd.args(["-"]).write_stdin("").assert().success(); Ok(()) } @@ -14,7 +14,7 @@ fn test_stdin_success() -> Result<()> { fn test_stdin_error() -> Result<()> { let mut cmd = Command::cargo_bin(crate_name!())?; let output = cmd - .args(&["-"]) + .args(["-"]) .write_stdin("import os\n") .assert() .failure(); @@ -26,7 +26,7 @@ fn test_stdin_error() -> Result<()> { fn test_stdin_filename() -> Result<()> { let mut cmd = Command::cargo_bin(crate_name!())?; let output = cmd - .args(&["-", "--stdin-filename", "F401.py"]) + .args(["-", "--stdin-filename", "F401.py"]) .write_stdin("import os\n") .assert() .failure(); @@ -38,7 +38,7 @@ fn test_stdin_filename() -> Result<()> { fn test_stdin_autofix() -> Result<()> { let mut cmd = Command::cargo_bin(crate_name!())?; let output = cmd - .args(&["-", "--fix"]) + .args(["-", "--fix"]) .write_stdin("import os\nimport sys\n\nprint(sys.version)\n") .assert() .success(); @@ -53,7 +53,7 @@ fn test_stdin_autofix() -> Result<()> { fn test_stdin_autofix_when_not_fixable_should_still_print_contents() -> Result<()> { let mut cmd = Command::cargo_bin(crate_name!())?; let output = cmd - .args(&["-", "--fix"]) + .args(["-", "--fix"]) .write_stdin("import os\nimport sys\n\nif (1, 2):\n print(sys.version)\n") .assert() .failure(); @@ -68,7 +68,7 @@ fn test_stdin_autofix_when_not_fixable_should_still_print_contents() -> Result<( fn test_stdin_autofix_when_no_issues_should_still_print_contents() -> Result<()> { let mut cmd = Command::cargo_bin(crate_name!())?; let output = cmd - .args(&["-", "--fix"]) + .args(["-", "--fix"]) .write_stdin("import sys\n\nprint(sys.version)\n") .assert() .success();