rust-lang/rust-clippy

New lint: clone on arguments taken by reference

Open

#2,074 建立於 2017年9月19日

在 GitHub 查看
 (9 留言) (0 反應) (1 負責人)Rust (1,391 fork)batch import
A-lintL-unnecessaryT-middlegood first issue

倉庫指標

Star
 (10,406 star)
PR 合併指標
 (平均合併 19天 22小時) (30 天內合併 113 個 PR)

描述

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

貢獻者指南