From a80d98c354751270d9e18605ebb49b1e9a3d57bf Mon Sep 17 00:00:00 2001 From: liquidsec Date: Mon, 27 Jul 2026 17:20:51 -0400 Subject: [PATCH 1/3] fix clippy on rust 1.97 and pin the toolchain Every open PR has been failing Rust Tests at the clippy step, dependabot's and ours alike, including PRs that touch nothing but a Python dev dependency. The bumps aren't the cause. CI installs whatever the latest stable is, with no pin. Stable moved to 1.97.1, whose clippy extended manual_filter to catch this in mock.rs: files_obj.and_then(|f| if f.is_none() { None } else { Some(f) }) That code is unchanged and has been on dev for a while. It only started failing because the lint is new and the workflow runs -D warnings, so a fresh lint turns into a hard error everywhere at once. Locally we were on 1.95, which is why nobody saw it coming. Rewritten as filter(|f| !f.is_none()), which is what clippy suggests and is behavior-identical. The pin is the actual fix for the class of problem. rust-toolchain.toml rather than a workflow input, so local cargo resolves to the same version CI uses and this gets caught before pushing instead of after. Keeping -D warnings is fine once the version is pinned, since new lints then arrive only when someone bumps it deliberately. Verified with 1.97.1: fmt, clippy --all-targets --all-features --locked -D warnings, and cargo test --locked all pass. --- rust-toolchain.toml | 12 ++++++++++++ src/mock.rs | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 rust-toolchain.toml diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..b2d263f --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,12 @@ +# Pinned so a new Rust release can't break every open PR at once. +# +# CI lints with `-D warnings`, so any lint that a fresh stable adds becomes a +# hard failure on every branch the moment it ships, whether or not the branch +# touched the code in question. Pinning here (rather than in the workflow) also +# means local `cargo clippy` matches CI, so you find these before pushing. +# +# Bump this deliberately, fix whatever the new version complains about in the +# same commit. +[toolchain] +channel = "1.97.1" +components = ["clippy", "rustfmt"] diff --git a/src/mock.rs b/src/mock.rs index d7a63de..133d263 100644 --- a/src/mock.rs +++ b/src/mock.rs @@ -838,7 +838,7 @@ impl PyBlasthttpMock { Some(body_obj) }; let files_obj = bound.getattr("files").ok(); - let files = files_obj.and_then(|f| if f.is_none() { None } else { Some(f) }); + let files = files_obj.filter(|f| !f.is_none()); let (body_bytes, final_headers) = crate::python::apply_body_and_files(body, files, headers)?; mock_entries.push(MockBatchEntry { From d9f6f129455a39cea162c93d4fa38ac4505c885b Mon Sep 17 00:00:00 2001 From: liquidsec Date: Mon, 27 Jul 2026 17:38:16 -0400 Subject: [PATCH 2/3] trim rust-toolchain.toml comment --- rust-toolchain.toml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b2d263f..3b10722 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,12 +1,4 @@ -# Pinned so a new Rust release can't break every open PR at once. -# -# CI lints with `-D warnings`, so any lint that a fresh stable adds becomes a -# hard failure on every branch the moment it ships, whether or not the branch -# touched the code in question. Pinning here (rather than in the workflow) also -# means local `cargo clippy` matches CI, so you find these before pushing. -# -# Bump this deliberately, fix whatever the new version complains about in the -# same commit. +# Pinned so new clippy lints dont break dependabot PRs [toolchain] channel = "1.97.1" components = ["clippy", "rustfmt"] From 1bed7d864cfaab5c8831f7c962126eb020d01999 Mon Sep 17 00:00:00 2001 From: liquidsec Date: Mon, 27 Jul 2026 18:42:04 -0400 Subject: [PATCH 3/3] keep the toolchain pin out of the sdist It was shipping in the packaged crate, overriding the toolchain for anyone building from source. Also fixes the comment typo. --- Cargo.toml | 2 ++ rust-toolchain.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d8a7259..355c69b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,8 @@ version = "0.9.0" edition = "2024" description = "Offensive-first HTTP library with Python bindings" license = "GPL-3.0" +# CI-only pin. Shipping it would override the toolchain of anyone building from the sdist. +exclude = ["rust-toolchain.toml"] [lib] # When building as a Python module, we need a cdylib (shared library). diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3b10722..1199015 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ -# Pinned so new clippy lints dont break dependabot PRs +# Pinned so new clippy lints don't break dependabot PRs. Bump deliberately, fixing new lints in the same commit. [toolchain] channel = "1.97.1" components = ["clippy", "rustfmt"]