about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel E. Moelius III <sam@moeli.us>2021-12-15 05:25:47 -0500
committerSamuel E. Moelius III <sam@moeli.us>2021-12-15 05:25:47 -0500
commitb8913894a13431bea99400dc9f53a1fd9f41a6c6 (patch)
treefa0c4f45b7d51dc4d4d3b158e78fbcc59d9c56eb
parent3beb6b1908e03bbf645ecdac7d56a772b5d8a8ef (diff)
downloadrust-b8913894a13431bea99400dc9f53a1fd9f41a6c6.tar.gz
rust-b8913894a13431bea99400dc9f53a1fd9f41a6c6.zip
Expand `is_clone_like` comment
-rw-r--r--clippy_lints/src/methods/implicit_clone.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/clippy_lints/src/methods/implicit_clone.rs b/clippy_lints/src/methods/implicit_clone.rs
index ff7904ce582..90492ffda3c 100644
--- a/clippy_lints/src/methods/implicit_clone.rs
+++ b/clippy_lints/src/methods/implicit_clone.rs
@@ -32,6 +32,9 @@ pub fn check(cx: &LateContext<'_>, method_name: &str, expr: &hir::Expr<'_>, recv
 }
 
 /// Returns true if the named method can be used to clone the receiver.
+/// Note that `to_string` is not flagged by `implicit_clone`. So other lints that call
+/// `is_clone_like` and that do flag `to_string` must handle it separately. See, e.g.,
+/// `is_to_owned_like` in `unnecessary_to_owned.rs`.
 pub fn is_clone_like(cx: &LateContext<'_>, method_name: &str, method_def_id: hir::def_id::DefId) -> bool {
     match method_name {
         "to_os_string" => is_diag_item_method(cx, method_def_id, sym::OsStr),