@@ -2,6 +2,7 @@ use super::EXPLICIT_ITER_LOOP;
22use clippy_utils:: diagnostics:: span_lint_and_sugg;
33use clippy_utils:: msrvs:: { self , Msrv } ;
44use clippy_utils:: source:: snippet_with_applicability;
5+ use clippy_utils:: sym;
56use clippy_utils:: ty:: {
67 implements_trait, implements_trait_with_env, is_copy, is_type_lang_item, make_normalized_projection,
78 make_normalized_projection_with_regions, normalize_with_regions,
@@ -11,7 +12,6 @@ use rustc_hir::{Expr, Mutability};
1112use rustc_lint:: LateContext ;
1213use rustc_middle:: ty:: adjustment:: { Adjust , Adjustment , AutoBorrow , AutoBorrowMutability } ;
1314use rustc_middle:: ty:: { self , EarlyBinder , Ty } ;
14- use rustc_span:: sym;
1515
1616pub ( super ) fn check (
1717 cx : & LateContext < ' _ > ,
@@ -119,7 +119,7 @@ fn is_ref_iterable<'tcx>(
119119 && let typing_env = ty:: TypingEnv :: non_body_analysis ( cx. tcx , fn_id)
120120 && implements_trait_with_env ( cx. tcx , typing_env, req_self_ty, trait_id, Some ( fn_id) , & [ ] )
121121 && let Some ( into_iter_ty) =
122- make_normalized_projection_with_regions ( cx. tcx , typing_env, trait_id, sym ! ( IntoIter ) , [ req_self_ty] )
122+ make_normalized_projection_with_regions ( cx. tcx , typing_env, trait_id, sym:: IntoIter , [ req_self_ty] )
123123 && let req_res_ty = normalize_with_regions ( cx. tcx , typing_env, req_res_ty)
124124 && into_iter_ty == req_res_ty
125125 {
@@ -152,7 +152,7 @@ fn is_ref_iterable<'tcx>(
152152 // Using by value won't consume anything
153153 if implements_trait ( cx, self_ty, trait_id, & [ ] )
154154 && let Some ( ty) =
155- make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym ! ( IntoIter ) , [ self_ty] )
155+ make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym:: IntoIter , [ self_ty] )
156156 && ty == res_ty
157157 {
158158 return Some ( ( AdjustKind :: None , self_ty) ) ;
@@ -169,7 +169,7 @@ fn is_ref_iterable<'tcx>(
169169 } ;
170170 if implements_trait ( cx, self_ty, trait_id, & [ ] )
171171 && let Some ( ty) =
172- make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym ! ( IntoIter ) , [ self_ty] )
172+ make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym:: IntoIter , [ self_ty] )
173173 && ty == res_ty
174174 {
175175 return Some ( ( AdjustKind :: reborrow ( mutbl) , self_ty) ) ;
@@ -183,7 +183,7 @@ fn is_ref_iterable<'tcx>(
183183 let self_ty = Ty :: new_ref ( cx. tcx , cx. tcx . lifetimes . re_erased , self_ty, mutbl) ;
184184 if implements_trait ( cx, self_ty, trait_id, & [ ] )
185185 && let Some ( ty) =
186- make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym ! ( IntoIter ) , [ self_ty] )
186+ make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym:: IntoIter , [ self_ty] )
187187 && ty == res_ty
188188 {
189189 return Some ( ( AdjustKind :: borrow ( mutbl) , self_ty) ) ;
@@ -206,7 +206,7 @@ fn is_ref_iterable<'tcx>(
206206 && target != self_ty
207207 && implements_trait ( cx, target, trait_id, & [ ] )
208208 && let Some ( ty) =
209- make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym ! ( IntoIter ) , [ target] )
209+ make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym:: IntoIter , [ target] )
210210 && ty == res_ty
211211 {
212212 Some ( ( AdjustKind :: auto_reborrow ( mutbl) , target) )
@@ -224,7 +224,7 @@ fn is_ref_iterable<'tcx>(
224224 if is_copy ( cx, target)
225225 && implements_trait ( cx, target, trait_id, & [ ] )
226226 && let Some ( ty) =
227- make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym ! ( IntoIter ) , [ target] )
227+ make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym:: IntoIter , [ target] )
228228 && ty == res_ty
229229 {
230230 Some ( ( AdjustKind :: Deref , target) )
@@ -242,7 +242,7 @@ fn is_ref_iterable<'tcx>(
242242 if self_ty. is_ref ( )
243243 && implements_trait ( cx, target, trait_id, & [ ] )
244244 && let Some ( ty) =
245- make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym ! ( IntoIter ) , [ target] )
245+ make_normalized_projection ( cx. tcx , cx. typing_env ( ) , trait_id, sym:: IntoIter , [ target] )
246246 && ty == res_ty
247247 {
248248 Some ( ( AdjustKind :: auto_borrow ( mutbl) , target) )
0 commit comments