Skip to content

chore(lint): enable clippy::redundant_clone#170

Open
tupe12334 wants to merge 1 commit into
mainfrom
clippy/enable-redundant_clone
Open

chore(lint): enable clippy::redundant_clone#170
tupe12334 wants to merge 1 commit into
mainfrom
clippy/enable-redundant_clone

Conversation

@tupe12334

Copy link
Copy Markdown
Member

Closes #169

What

Promotes clippy::redundant_clone to deny in core/Cargo.toml, continuing the crate's incremental lint-ratcheting policy (one lint promoted per PR).

 cloned_instead_of_copied = "deny"
+redundant_clone = "deny"

Why

clippy::redundant_clone flags a .clone() whose result is the last use of the value — the original is never touched again, so the clone allocates a fresh copy where a plain move would do. Enabling it:

  • removes needless heap allocations / deep copies (small but real perf + memory win),
  • keeps .clone() honest as a signal of "I need an independent copy",
  • completes the crate's clone-hygiene lint family alongside the already-denied implicit_clone and cloned_instead_of_copied.

Validation

There are zero current violations, so this is a clean lock-in / regression guard (matching the other deny-on-clean lints in core/Cargo.toml). All green:

  • cargo clippy --all-targets — passes (exit 0)
  • cargo build — passes
  • cargo test — passes

Note: redundant_clone is a nursery lint; it is enabled here as a single, conservative, zero-violation addition (no group-wide enablement), consistent with the repo's existing nursery picks (option_if_let_else, missing_const_for_fn).


This pull request was opened by the "Clippy lint improvements → issue + PR (Rust repos) → Slack" routine of moadim.

Promote clippy::redundant_clone to deny in core/Cargo.toml, continuing
the crate's incremental lint-ratcheting policy. Catches .clone() calls
whose result is the last use of the value (the original is dead), which
allocate a fresh copy where a move would do. Completes the existing
clone-hygiene family (implicit_clone, cloned_instead_of_copied).

Zero current violations; clippy/build/test all pass.

Closes #169
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.

Enable clippy::redundant_clone lint

1 participant