chore: clippy is red on main — approx_constant in engine.rs plus 139 warnings #4

Open
opened 2026-11-14 10:59:14 +00:00 by ben · 0 comments
Owner

cargo clippy --all-targets does not finish on main: it stops on one deny-level lint and reports 139 warnings beside it. cargo test, --audit, --controls, --uitest and --selftest are all green, so this is about the next change, not about the app.

error: approximate value of `f{32, 64}::consts::TAU` found
    --> src/engine.rs:2979:85
2979 |   let a = (y as f32 / h as f32) * std::f32::consts::TAU + phase * 6.28;
     |                                                               ^^^^
     = note: `#[deny(clippy::approx_constant)]` on by default

clippy::approx_constant is deny by default, so nothing else gets looked at until this is decided.

Why it is not a one-line fix

6.28 is not a typo of TAU — it is 0.05 % short, and it sits in the pattern generator, so replacing it moves every pixel of that algorithm by a hair. Either

  • the value is deliberate (then it wants a name of its own, e.g. const TURN: f32 = 6.28;, and the lint silenced where it is used with the reason), or
  • it is an approximation nobody measured (then TAU is right, and the change should say so and show the render before and after).

The second answer needs a picture to compare, so it is a small change with a real decision in it, not a drive-by.

The warnings beside it

139 warnings, 86 of them duplicates of the same pattern (mostly field_reassign_with_default — 73 hits — plus sort_by_key, chunks_exact, needless borrows and let_and_return). None of them is a bug; the value is that a new warning becomes visible again. Proposed order:

  1. Decide 6.28 (the error), so clippy produces output at all.
  2. field_reassign_with_default and sort_by_key in one mechanical pass — a commit of its own, no behaviour change, added to .git-blame-ignore-revs.
  3. Whatever is left, one warning at a time, or an allow with a reason next to it.

Done when

cargo clippy --all-targets -- -D warnings exits 0 on main, CONTRIBUTING.md and AGENTS.md list it as a gate next to cargo fmt --check, and the render of the affected algorithm is unchanged — or changed on purpose, with the two pictures in the pull request.

`cargo clippy --all-targets` does not finish on `main`: it stops on one `deny`-level lint and reports 139 warnings beside it. `cargo test`, `--audit`, `--controls`, `--uitest` and `--selftest` are all green, so this is about the next change, not about the app. ``` error: approximate value of `f{32, 64}::consts::TAU` found --> src/engine.rs:2979:85 2979 | let a = (y as f32 / h as f32) * std::f32::consts::TAU + phase * 6.28; | ^^^^ = note: `#[deny(clippy::approx_constant)]` on by default ``` `clippy::approx_constant` is `deny` by default, so nothing else gets looked at until this is decided. ## Why it is not a one-line fix `6.28` is not a typo of `TAU` — it is 0.05 % short, and it sits in the pattern generator, so replacing it moves every pixel of that algorithm by a hair. Either - the value is deliberate (then it wants a name of its own, e.g. `const TURN: f32 = 6.28;`, and the lint silenced where it is used with the reason), or - it is an approximation nobody measured (then `TAU` is right, and the change should say so and show the render before and after). The second answer needs a picture to compare, so it is a small change with a real decision in it, not a drive-by. ## The warnings beside it 139 warnings, 86 of them duplicates of the same pattern (mostly `field_reassign_with_default` — 73 hits — plus `sort_by_key`, `chunks_exact`, needless borrows and `let_and_return`). None of them is a bug; the value is that a *new* warning becomes visible again. Proposed order: 1. Decide `6.28` (the error), so clippy produces output at all. 2. `field_reassign_with_default` and `sort_by_key` in one mechanical pass — a commit of its own, no behaviour change, added to `.git-blame-ignore-revs`. 3. Whatever is left, one warning at a time, or an `allow` with a reason next to it. ## Done when `cargo clippy --all-targets -- -D warnings` exits 0 on `main`, `CONTRIBUTING.md` and `AGENTS.md` list it as a gate next to `cargo fmt --check`, and the render of the affected algorithm is unchanged — or changed on purpose, with the two pictures in the pull request.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ben/openDither#4
No description provided.