What
Enable the clippy::redundant_clone lint (set to deny) in core/Cargo.toml, continuing the crate's incremental lint-ratcheting policy (each PR promotes one more lint to deny).
What it catches
clippy::redundant_clone flags .clone() (and .to_owned() / .to_vec() style) calls whose result is the last use of the cloned value — i.e. the original is never used again, so the clone allocates a fresh copy for nothing. The owned value could have been moved instead.
Example:
let name = config.name.clone(); // config.name never used after this
return Step::new(name); // -> just move config.name
Why it improves code quality
- Removes needless heap allocations / deep copies — a real, if small, runtime + memory win, especially on hot paths that clone
String/Vec/owned structs.
- States intent honestly — a
.clone() signals "I need an independent copy"; when the original is dead, the clone is noise that misleads the reader.
- Completes the crate's existing clone-hygiene family —
implicit_clone and cloned_instead_of_copied are already denied; redundant_clone closes the remaining gap (clones that should have been moves).
Scope
There are zero current violations, so this is a clean lock-in that prevents regressions — consistent with the other deny-on-clean lints already in core/Cargo.toml. cargo clippy --all-targets, cargo build, and cargo test all pass with the lint enabled.
This issue was opened by the "Clippy lint improvements → issue + PR (Rust repos) → Slack" routine of moadim.
What
Enable the
clippy::redundant_clonelint (set todeny) incore/Cargo.toml, continuing the crate's incremental lint-ratcheting policy (each PR promotes one more lint todeny).What it catches
clippy::redundant_cloneflags.clone()(and.to_owned()/.to_vec()style) calls whose result is the last use of the cloned value — i.e. the original is never used again, so the clone allocates a fresh copy for nothing. The owned value could have been moved instead.Example:
Why it improves code quality
String/Vec/owned structs..clone()signals "I need an independent copy"; when the original is dead, the clone is noise that misleads the reader.implicit_cloneandcloned_instead_of_copiedare already denied;redundant_clonecloses the remaining gap (clones that should have been moves).Scope
There are zero current violations, so this is a clean lock-in that prevents regressions — consistent with the other
deny-on-clean lints already incore/Cargo.toml.cargo clippy --all-targets,cargo build, andcargo testall pass with the lint enabled.This issue was opened by the "Clippy lint improvements → issue + PR (Rust repos) → Slack" routine of moadim.