rust-lang/rust-clippy

New lint: clone on arguments taken by reference

Open

#2074 aperta il 19 set 2017

Vedi su GitHub
 (9 commenti) (0 reazioni) (1 assegnatario)Rust (1391 fork)batch import
A-lintL-unnecessaryT-middlegood first issue

Metriche repository

Star
 (10.406 star)
Metriche merge PR
 (Merge medio 19g 22h) (113 PR mergiate in 30 g)

Descrizione

If a function takes an argument by reference, but later calls .clone() on it (or otherwise requires an impl Clone or impl Copy from it), lint that taking it by ownership allows the caller to pass in its memory rather than forcing a clone on the data.

I don't know if this is possible, but can it default to allow on public functions and deny on crate-private functions (due to the API change)?

Guida contributor