Skip to content

fix: satisfy clippy::useless_borrows_in_formatting (unbreaks CI)#370

Merged
dubadub merged 1 commit into
mainfrom
fix/clippy-1.97-redundant-refs
Jul 14, 2026
Merged

fix: satisfy clippy::useless_borrows_in_formatting (unbreaks CI)#370
dubadub merged 1 commit into
mainfrom
fix/clippy-1.97-redundant-refs

Conversation

@dubadub

@dubadub dubadub commented Jul 14, 2026

Copy link
Copy Markdown
Member

CI on main is broken, and every open PR is red because of it — including a docs-only one. This is the fix.

Cause

The Test workflow installs stable and runs cargo clippy -- -D warnings. Stable has since moved to Rust 1.97, which added useless_borrows_in_formatting. It fires on two pre-existing sites:

  • src/server/mod.rs:179println!("...{:?}", &state.base_path)
  • src/util/cooklang_to_cooklang.rs:118&igr.name as a format! argument

Nothing changed in the repo. main's last green run was 1 July; the toolchain moved underneath it. Clippy's failure is the first step in the job, so builds and tests never even run — which is why #367, #368 and #369 all report Test fail despite passing locally.

Change

Drop the two redundant references. No behaviour change: Display/Debug are implemented for both the value and the reference, so the formatted output is identical.

Verification

Reproduced the failure on main with a pinned 1.97 toolchain, then confirmed the fix against the same toolchain CI uses:

  • cargo +1.97 clippy --all-targets -- -D warnings — 0 issues (default and --no-default-features)
  • cargo +1.97 fmt --check — clean
  • cargo +1.97 test — 13 suites pass

Worth merging first — the other PRs cannot show green until this lands.

Rust 1.97 added useless_borrows_in_formatting, which fires on two
existing sites. CI installs stable and runs clippy with -D warnings, so
main goes red on the next run through no change of its own.

Drop the redundant references. No behaviour change - Display and Debug
are implemented for both the value and the reference.
@claude

claude Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review

Small, well-scoped fix — verified both hunks against current main.

Correctness

  • src/server/mod.rs:179: state.base_path is Utf8PathBuf inside Arc<AppState>; println!("{:?}", ...) only needs &Utf8PathBuf implicitly via Debug::fmt, so dropping the explicit & doesn't move anything. Confirmed state.base_path is still used later (line 188, ServeDir::new(&state.base_path)) — no borrow/move conflict introduced.
  • src/util/cooklang_to_cooklang.rs:118: igr is itself &recipe.ingredients[index], so igr.name is a field access through a reference — same reasoning, no behavior change. igr is still used afterward (igr.modifiers(), etc.), consistent with the PR description.

Both match exactly what clippy::useless_borrows_in_formatting (new in Rust 1.97) flags — redundant & on values that already implement Display/Debug and are used in a formatting macro. No semantic change, output is identical.

Code quality / style: Diff is minimal and idiomatic — this is the correct fix rather than suppressing the lint with an #[allow].

Scope: I swept the rest of src/ for the same format!/println! pattern with a leading & on the last arg and didn't find other latent occurrences, so the PR isn't missing sibling fixes.

Tests / CI: No test coverage needed — this is a non-behavioral lint fix. The PR description documents reproduction against a pinned 1.97 toolchain (clippy --all-targets -D warnings, fmt --check, cargo test), which is exactly the right verification for a CI-unblock PR like this.

Security: None applicable — no user input, no I/O behavior change.

No issues found. LGTM — this should merge quickly since (per the PR description) it's blocking green CI for other open PRs.

@dubadub dubadub merged commit 6120c7c into main Jul 14, 2026
6 checks passed
@dubadub dubadub deleted the fix/clippy-1.97-redundant-refs branch July 14, 2026 10:46
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.

1 participant