@@ -114,19 +114,17 @@ fn handle_path(
114
114
) {
115
115
if let Some ( path_def_id) = cx. qpath_res ( qpath, arg. hir_id ) . opt_def_id ( )
116
116
&& cx. tcx . lang_items ( ) . get ( LangItem :: CloneFn ) == Some ( path_def_id)
117
- {
118
117
// The `copied` and `cloned` methods are only available on `&T` and `&mut T` in `Option`
119
118
// and `Result`.
120
- if let ty:: Adt ( _, args) = cx. typeck_results ( ) . expr_ty ( recv) . kind ( )
121
- && let args = args. as_slice ( )
122
- && let Some ( ty) = args. iter ( ) . find_map ( |generic_arg| generic_arg. as_type ( ) )
123
- && let ty:: Ref ( _, ty, Mutability :: Not ) = ty. kind ( )
124
- && let ty:: FnDef ( _, lst) = cx. typeck_results ( ) . expr_ty ( arg) . kind ( )
125
- && lst. iter ( ) . all ( |l| l. as_type ( ) == Some ( * ty) )
126
- && !should_call_clone_as_function ( cx, * ty)
127
- {
128
- lint_path ( cx, e. span , recv. span , is_copy ( cx, ty. peel_refs ( ) ) ) ;
129
- }
119
+ && let ty:: Adt ( _, args) = cx. typeck_results ( ) . expr_ty ( recv) . kind ( )
120
+ && let args = args. as_slice ( )
121
+ && let Some ( ty) = args. iter ( ) . find_map ( |generic_arg| generic_arg. as_type ( ) )
122
+ && let ty:: Ref ( _, ty, Mutability :: Not ) = ty. kind ( )
123
+ && let ty:: FnDef ( _, lst) = cx. typeck_results ( ) . expr_ty ( arg) . kind ( )
124
+ && lst. iter ( ) . all ( |l| l. as_type ( ) == Some ( * ty) )
125
+ && !should_call_clone_as_function ( cx, * ty)
126
+ {
127
+ lint_path ( cx, e. span , recv. span , is_copy ( cx, ty. peel_refs ( ) ) ) ;
130
128
}
131
129
}
132
130
0 commit comments