[hygiene] cargo clippy --workspace -- -D warnings reports ~99 warnings #22

Closed
opened 2026-05-04 18:10:09 +00:00 by mik-tf · 1 comment
Owner

Summary

cargo clippy --workspace --all-targets -- -D warnings reports ~99 warnings on hero_biz development as of 2026-05-04 (commit ec1047b). CI doesn't gate on clippy today (only cargo check + cargo build in build.yaml), so drift accumulates silently.

This is a workspace-wide hygiene issue, not blocking the --from-ci rollout (handled in #?). Filed as a separate concern so the rollout PR stays focused.

Breakdown

41x error: this expression creates a reference which is immediately dereferenced
28x error: this `if` statement can be collapsed
16x error: `to_string` applied to a type that implements `Display` in `format!` args
 3x error: needlessly taken reference of left operand
 3x error: field assignment outside of initializer for an instance created with Default::default()
 2x error: writing `&PathBuf` instead of `&Path`
 2x error: this function has too many arguments (8/7)
 2x error: stripping a prefix manually
 1x error: explicit closure for copying elements
 1x error: this loop never actually loops

Suggested approach

  1. cargo clippy --fix --workspace --all-targets --allow-dirty → resolves most needless_borrow / collapsible_if / format-arg fixes mechanically (probably 60-80 of the 99).
  2. cargo fmt --all after, since clippy --fix sometimes un-formats.
  3. Manual fixes for the remaining (too_many_arguments, default_trait_access, never_loop) — either resolve or #[allow] with rationale.
  4. Add a clippy step to build.yaml so future drift is caught on push.

Estimated effort: ~1-2h.

Refs

  • hero_demo#54--from-ci rollout (separate)
  • Related drift caught and fixed inline on hero_slides during the slides rollout (11 errors there, much smaller scale)

Out of scope

  • Performance fixes
  • API redesign
  • Test additions

Pure hygiene + add a CI gate.

Signed-off-by: mik-tf

## Summary `cargo clippy --workspace --all-targets -- -D warnings` reports ~99 warnings on hero_biz development as of 2026-05-04 (commit `ec1047b`). CI doesn't gate on clippy today (only `cargo check` + `cargo build` in `build.yaml`), so drift accumulates silently. This is a workspace-wide hygiene issue, not blocking the `--from-ci` rollout (handled in [#?](https://forge.ourworld.tf/lhumina_code/hero_biz/pulls)). Filed as a separate concern so the rollout PR stays focused. ## Breakdown ``` 41x error: this expression creates a reference which is immediately dereferenced 28x error: this `if` statement can be collapsed 16x error: `to_string` applied to a type that implements `Display` in `format!` args 3x error: needlessly taken reference of left operand 3x error: field assignment outside of initializer for an instance created with Default::default() 2x error: writing `&PathBuf` instead of `&Path` 2x error: this function has too many arguments (8/7) 2x error: stripping a prefix manually 1x error: explicit closure for copying elements 1x error: this loop never actually loops ``` ## Suggested approach 1. `cargo clippy --fix --workspace --all-targets --allow-dirty` → resolves most needless_borrow / collapsible_if / format-arg fixes mechanically (probably 60-80 of the 99). 2. `cargo fmt --all` after, since clippy --fix sometimes un-formats. 3. Manual fixes for the remaining (too_many_arguments, default_trait_access, never_loop) — either resolve or `#[allow]` with rationale. 4. Add a `clippy` step to `build.yaml` so future drift is caught on push. Estimated effort: ~1-2h. ## Refs - [hero_demo#54](https://forge.ourworld.tf/lhumina_code/hero_demo/issues/54) — `--from-ci` rollout (separate) - Related drift caught and fixed inline on hero_slides during the slides rollout (11 errors there, much smaller scale) ## Out of scope - Performance fixes - API redesign - Test additions Pure hygiene + add a CI gate. Signed-off-by: mik-tf
Member

Fixed in eb03045 (Rust 2024 closure types, clippy fixes) and 325d2c6 (rustfmt pass). cargo clippy --workspace --all-targets -- -D warnings now passes with zero warnings. CI gate added to build.yaml as a dedicated Clippy step.

Fixed in eb03045 (Rust 2024 closure types, clippy fixes) and 325d2c6 (rustfmt pass). `cargo clippy --workspace --all-targets -- -D warnings` now passes with zero warnings. CI gate added to `build.yaml` as a dedicated Clippy step.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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
lhumina_code/hero_biz#22
No description provided.