rust-lang/rust-clippy

New lint: clone on arguments taken by reference

Open

#2,074 opened on 2017年9月19日

GitHub で見る
 (9 comments) (0 reactions) (1 assignee)Rust (1,391 forks)batch import
A-lintL-unnecessaryT-middlegood first issue

Repository metrics

Stars
 (10,406 stars)
PR merge metrics
 (平均マージ 19d 22h) (30d で 113 merged PRs)

説明

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)?

コントリビューターガイド