about summary refs log tree commit diff
path: root/clippy_lints/src/methods/implicit_clone.rs
diff options
context:
space:
mode:
Diffstat (limited to 'clippy_lints/src/methods/implicit_clone.rs')
-rw-r--r--clippy_lints/src/methods/implicit_clone.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/clippy_lints/src/methods/implicit_clone.rs b/clippy_lints/src/methods/implicit_clone.rs
index 519091406cc..9724463f0c0 100644
--- a/clippy_lints/src/methods/implicit_clone.rs
+++ b/clippy_lints/src/methods/implicit_clone.rs
@@ -1,15 +1,15 @@
 use clippy_utils::diagnostics::span_lint_and_sugg;
 use clippy_utils::source::snippet_with_context;
 use clippy_utils::ty::implements_trait;
-use clippy_utils::{is_diag_item_method, is_diag_trait_item, peel_middle_ty_refs};
+use clippy_utils::{is_diag_item_method, is_diag_trait_item, peel_middle_ty_refs, sym};
 use rustc_errors::Applicability;
 use rustc_hir as hir;
 use rustc_lint::LateContext;
-use rustc_span::sym;
+use rustc_span::Symbol;
 
 use super::IMPLICIT_CLONE;
 
-pub fn check(cx: &LateContext<'_>, method_name: &str, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) {
+pub fn check(cx: &LateContext<'_>, method_name: Symbol, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) {
     if let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id)
         && is_clone_like(cx, method_name, method_def_id)
         && let return_type = cx.typeck_results().expr_ty(expr)
@@ -43,12 +43,12 @@ pub fn check(cx: &LateContext<'_>, method_name: &str, expr: &hir::Expr<'_>, recv
 /// 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 {
+pub fn is_clone_like(cx: &LateContext<'_>, method_name: Symbol, method_def_id: hir::def_id::DefId) -> bool {
     match method_name {
-        "to_os_string" => is_diag_item_method(cx, method_def_id, sym::OsStr),
-        "to_owned" => is_diag_trait_item(cx, method_def_id, sym::ToOwned),
-        "to_path_buf" => is_diag_item_method(cx, method_def_id, sym::Path),
-        "to_vec" => cx
+        sym::to_os_string => is_diag_item_method(cx, method_def_id, sym::OsStr),
+        sym::to_owned => is_diag_trait_item(cx, method_def_id, sym::ToOwned),
+        sym::to_path_buf => is_diag_item_method(cx, method_def_id, sym::Path),
+        sym::to_vec => cx
             .tcx
             .impl_of_method(method_def_id)
             .filter(|&impl_did| {