From d8807c4f8fbabfca732d7e2a1a19dde96ae102e5 Mon Sep 17 00:00:00 2001 From: MechaCat02 Date: Sun, 6 Sep 2026 10:17:55 +0200 Subject: [PATCH] fix(formats): collapse the one `else { if }`, so both toolchains agree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ascii_runs` in movie_manifest.rs had a nested `else { if .. }`. Clippy's `collapsible_else_if` flags it — on some toolchains. WHY IT WAS NEVER CAUGHT, AND WHY THAT IS THE INTERESTING PART: clippy::collapsible-else-if @1.92.0 (2025-12-08) -> warn clippy::collapsible-else-if @1.98.1 (2026-09-01) -> allow CI installs `dtolnay/rust-toolchain@stable`, which floats. The runner is on 1.98.1, where this lint is allow-by-default, so the Clippy job passed. A local run on a nine-month-old stable failed on the same bytes. Neither instrument was broken; "clippy clean" is simply a statement about a toolchain and a date, and nothing in the pipeline records which. That is #15, and this commit does not fix it -- it removes one instance of its consequence. Fixing it rather than pinning, because `else { if }` is worse code on every version. A tree whose cleanliness is contingent on a release date is the thing to avoid; agreeing with both toolchains is cheaper than arguing about which one is right. ⚠️ I FIRST DIAGNOSED THIS WRONG, and the wrong version is worth recording. From CI's rustfmt reporting 774 hunks and mine reporting 774, I concluded the toolchains matched, therefore the clippys matched, therefore CI's green must be a cached or ungated result -- "the frozen splash again". Every step after the first was false. rustfmt is deliberately output-stable within a style edition; clippy explicitly moves lints between groups. Measured here afterwards: rustfmt 1.8.0-stable -> 774 hunks rustfmt 1.9.0-stable -> 774 hunks (nine months apart, identical) So formatting parity carries no information about which clippy ran. It is the same error as reading protection off a settings page or reachability off a DNS record: a property inferred from something ADJACENT to it. The peer refuted it by measurement -- `No cache found` in the run log, and `success()` evaluating 'true' in 207 against 'false' in 203 -- rather than by accepting the framing. Verified on both: 1.92.0 `clippy --workspace -- -D warnings` rc=0 (was 101); 1.98.1 with the lint forced on, 0 sites. rustfmt still 774, so no debt added to #12. Tests 207 passed / 0 failed / 14 ignored, unchanged. --- crates/sylpheed-formats/src/movie_manifest.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/sylpheed-formats/src/movie_manifest.rs b/crates/sylpheed-formats/src/movie_manifest.rs index 1210c30c..8fe955be 100644 --- a/crates/sylpheed-formats/src/movie_manifest.rs +++ b/crates/sylpheed-formats/src/movie_manifest.rs @@ -339,12 +339,10 @@ fn ascii_runs(bytes: &[u8], min: usize) -> Vec { for &b in bytes { if (0x20..=0x7e).contains(&b) { cur.push(b as char); + } else if cur.len() >= min { + out.push(std::mem::take(&mut cur)); } else { - if cur.len() >= min { - out.push(std::mem::take(&mut cur)); - } else { - cur.clear(); - } + cur.clear(); } } if cur.len() >= min {