Skip to content

style(css): clippy 1.99 failed the workspace on a range loop in mix2 - #117

Merged
jamesconwaydev merged 1 commit into
parsec-html:mainfrom
foothillsdigital:fix/clippy-needless-range-loop
Nov 19, 2026
Merged

jamesconwaydev merged 1 commit into
parsec-html:mainfrom
foothillsdigital:fix/clippy-needless-range-loop

Conversation

@foothillsdigital

Copy link
Copy Markdown
Collaborator

Problem

Under Rust 1.99's clippy, cargo clippy --workspace --all-targets -- -D warnings fails on main, in parsec-css:

error: the loop variable `i` is used to index `out`
   --> crates/parsec-css/src/values/convert.rs:922:14
    = help: ... #needless_range_loop

CI installs toolchain: stable with no pinned version, so its clippy job fails as soon as the runner picks up 1.99. I mentioned this on #115.

Change

mix2 loops over out with iter_mut().enumerate() and writes *slot. i still indexes both colours' channels and the hue check, as before. The behaviour is identical.

Tests

  • cargo clippy --workspace --all-targets -- -D warnings with Rust 1.99.1: fails on main, clean here.
  • cargo fmt --check is clean.
  • cargo test --release -p parsec-html-css passes (92 tests, 0 failed), including the colour-mixing tests that run through mix2.

Checklist

  • cargo fmt, cargo clippy -- -D warnings and cargo test pass locally
  • Tests cover the change, and a bug fix has the test that would have caught it (no behaviour change; the clippy run is the check)
  • Changes to crates/parsec/src, its tests, examples, scripts or fuzz targets were made in Netweir first (none: this is parsec-css)
  • The wiki is updated if the change is visible to people using Parsec (it isn't)
  • It's my own work, and not copied from another project in breach of its licence

@jamesconwaydev jamesconwaydev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch before CI's stable moved. Thanks.

@jamesconwaydev
jamesconwaydev enabled auto-merge (squash) November 19, 2026 20:26
needless_range_loop flags mix2's for i in 0..3, which indexes out. CI
installs stable, so its clippy job fails once the runner has 1.99.
Loop over out with iter_mut().enumerate(); i still indexes the two
colours' channels and the hue check.
@foothillsdigital
foothillsdigital force-pushed the fix/clippy-needless-range-loop branch from abde48f to af37ca4 Compare November 19, 2026 20:42
@foothillsdigital

Copy link
Copy Markdown
Collaborator Author

Rebased onto main (af37ca4), since main requires an up-to-date branch. The change is the same two lines. The push dismissed your approval, so it needs one more look when you have a moment.

@jamesconwaydev jamesconwaydev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same two lines, still good.

@jamesconwaydev
jamesconwaydev merged commit 470fea9 into parsec-html:main Nov 19, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants