11use super :: EXPLICIT_ITER_LOOP ;
22use clippy_utils:: diagnostics:: span_lint_and_sugg;
3+ use clippy_utils:: is_trait_method;
34use clippy_utils:: source:: snippet_with_applicability;
4- use clippy_utils:: ty:: { is_type_diagnostic_item, match_type} ;
5- use clippy_utils:: { match_trait_method, paths} ;
5+ use clippy_utils:: ty:: is_type_diagnostic_item;
66use rustc_errors:: Applicability ;
77use rustc_hir:: { Expr , Mutability } ;
88use rustc_lint:: LateContext ;
@@ -12,7 +12,7 @@ use rustc_span::sym;
1212pub ( super ) fn check ( cx : & LateContext < ' _ > , self_arg : & Expr < ' _ > , arg : & Expr < ' _ > , method_name : & str ) {
1313 let should_lint = match method_name {
1414 "iter" | "iter_mut" => is_ref_iterable_type ( cx, self_arg) ,
15- "into_iter" if match_trait_method ( cx, arg, & paths :: INTO_ITERATOR ) => {
15+ "into_iter" if is_trait_method ( cx, arg, sym :: IntoIterator ) => {
1616 let receiver_ty = cx. typeck_results ( ) . expr_ty ( self_arg) ;
1717 let receiver_ty_adjusted = cx. typeck_results ( ) . expr_ty_adjusted ( self_arg) ;
1818 let ref_receiver_ty = cx. tcx . mk_ref (
@@ -55,7 +55,7 @@ fn is_ref_iterable_type(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
5555 let ty = cx. typeck_results ( ) . expr_ty ( e) ;
5656 is_iterable_array ( ty, cx) ||
5757 is_type_diagnostic_item ( cx, ty, sym:: vec_type) ||
58- match_type ( cx, ty, & paths :: LINKED_LIST ) ||
58+ is_type_diagnostic_item ( cx, ty, sym :: LinkedList ) ||
5959 is_type_diagnostic_item ( cx, ty, sym:: hashmap_type) ||
6060 is_type_diagnostic_item ( cx, ty, sym:: hashset_type) ||
6161 is_type_diagnostic_item ( cx, ty, sym:: vecdeque_type) ||
0 commit comments