From 16c6b43b8ac4571a4ed2062e4bd157a2eeae8810 Mon Sep 17 00:00:00 2001 From: Louis Merlin Date: Mon, 2 Sep 2024 10:28:32 +0200 Subject: [PATCH 1/2] Fix clippy for CI --- Cargo.toml | 3 +++ examples/url/Cargo.toml | 3 +++ examples/url/src/main.rs | 2 +- src/bin/cargo-ziggy/fuzz.rs | 2 +- tests/arbitrary_fuzz.rs | 2 +- tests/url_fuzz.rs | 2 +- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d251cd8..48862fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,3 +45,6 @@ cli = [ "cargo_metadata", ] coverage = ["fork", "libc"] + +[lints.clippy] +needless_doctest_main = "allow" \ No newline at end of file diff --git a/examples/url/Cargo.toml b/examples/url/Cargo.toml index 51eb1f6..b19ce17 100644 --- a/examples/url/Cargo.toml +++ b/examples/url/Cargo.toml @@ -7,3 +7,6 @@ publish = false [dependencies] url = "2.5.0" ziggy = { path = "../../", default-features = false } + +[features] +fuzzing = [] \ No newline at end of file diff --git a/examples/url/src/main.rs b/examples/url/src/main.rs index b468195..ef3586f 100644 --- a/examples/url/src/main.rs +++ b/examples/url/src/main.rs @@ -11,7 +11,7 @@ // could assert that a certain value satisfies a property. fn invariant_fuzz(data: &str) { if let Ok(parsed) = url::Url::parse(data) { - #[cfg(not(fuzzing))] + #[cfg(not(feature = "fuzzing"))] println!("{data} => {parsed}"); // We assert that the string representation of the URL always contains a ':' // character. diff --git a/src/bin/cargo-ziggy/fuzz.rs b/src/bin/cargo-ziggy/fuzz.rs index d7112a8..acf1298 100644 --- a/src/bin/cargo-ziggy/fuzz.rs +++ b/src/bin/cargo-ziggy/fuzz.rs @@ -800,7 +800,7 @@ impl fmt::Display for FuzzingConfig { pub fn kill_subprocesses_recursively(pid: &str) -> Result<(), Error> { let subprocesses = process::Command::new("pgrep") - .arg(&format!("-P{pid}")) + .arg(format!("-P{pid}")) .output()?; for subprocess in std::str::from_utf8(&subprocesses.stdout)?.split('\n') { diff --git a/tests/arbitrary_fuzz.rs b/tests/arbitrary_fuzz.rs index 5c81286..9dc8152 100644 --- a/tests/arbitrary_fuzz.rs +++ b/tests/arbitrary_fuzz.rs @@ -7,7 +7,7 @@ use std::{ fn kill_subprocesses_recursively(pid: &str) { let subprocesses = process::Command::new("pgrep") - .arg(&format!("-P{pid}")) + .arg(format!("-P{pid}")) .output() .unwrap(); diff --git a/tests/url_fuzz.rs b/tests/url_fuzz.rs index 2ff51b8..8609ecd 100644 --- a/tests/url_fuzz.rs +++ b/tests/url_fuzz.rs @@ -7,7 +7,7 @@ use std::{ fn kill_subprocesses_recursively(pid: &str) { let subprocesses = process::Command::new("pgrep") - .arg(&format!("-P{pid}")) + .arg(format!("-P{pid}")) .output() .unwrap(); From 0b613ef927144ff3285a65eeaf8c21ada9c562e5 Mon Sep 17 00:00:00 2001 From: Louis Merlin Date: Mon, 2 Sep 2024 10:32:18 +0200 Subject: [PATCH 2/2] Add newline at end of Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 48862fe..621b422 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,4 +47,4 @@ cli = [ coverage = ["fork", "libc"] [lints.clippy] -needless_doctest_main = "allow" \ No newline at end of file +needless_doctest_main = "allow"