@@ -3,14 +3,13 @@ use clippy_utils::diagnostics::span_lint_and_then;
3
3
use clippy_utils:: mir:: { PossibleBorrowerMap , enclosing_mir} ;
4
4
use clippy_utils:: msrvs:: { self , Msrv } ;
5
5
use clippy_utils:: sugg:: Sugg ;
6
- use clippy_utils:: { is_diag_trait_item, is_in_test, last_path_segment, local_is_initialized, path_to_local} ;
6
+ use clippy_utils:: { is_diag_trait_item, is_in_test, last_path_segment, local_is_initialized, path_to_local, sym } ;
7
7
use rustc_errors:: Applicability ;
8
8
use rustc_hir:: { self as hir, Expr , ExprKind } ;
9
9
use rustc_lint:: { LateContext , LateLintPass } ;
10
10
use rustc_middle:: mir;
11
11
use rustc_middle:: ty:: { self , Instance , Mutability } ;
12
12
use rustc_session:: impl_lint_pass;
13
- use rustc_span:: symbol:: sym;
14
13
use rustc_span:: { Span , SyntaxContext } ;
15
14
16
15
declare_clippy_lint ! {
@@ -86,9 +85,9 @@ impl<'tcx> LateLintPass<'tcx> for AssigningClones {
86
85
&& ctxt. is_root ( )
87
86
&& let which_trait = match fn_name {
88
87
sym:: clone if is_diag_trait_item ( cx, fn_id, sym:: Clone ) => CloneTrait :: Clone ,
89
- _ if fn_name . as_str ( ) == " to_owned"
90
- && is_diag_trait_item ( cx, fn_id, sym:: ToOwned )
91
- && self . msrv . meets ( cx, msrvs:: CLONE_INTO ) =>
88
+ sym :: to_owned
89
+ if is_diag_trait_item ( cx, fn_id, sym:: ToOwned )
90
+ && self . msrv . meets ( cx, msrvs:: CLONE_INTO ) =>
92
91
{
93
92
CloneTrait :: ToOwned
94
93
} ,
@@ -112,7 +111,7 @@ impl<'tcx> LateLintPass<'tcx> for AssigningClones {
112
111
&& resolved_assoc_items. in_definition_order ( ) . any ( |assoc|
113
112
match which_trait {
114
113
CloneTrait :: Clone => assoc. name ( ) == sym:: clone_from,
115
- CloneTrait :: ToOwned => assoc. name ( ) . as_str ( ) == " clone_into" ,
114
+ CloneTrait :: ToOwned => assoc. name ( ) == sym :: clone_into,
116
115
}
117
116
)
118
117
&& !clone_source_borrows_from_dest ( cx, lhs, rhs. span )
0 commit comments