@@ -19,7 +19,7 @@ use rustc_middle::ty::subst::GenericArgKind;
1919use rustc_middle:: ty:: { self , Predicate , Ty } ;
2020use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
2121use rustc_span:: source_map:: Span ;
22- use rustc_span:: symbol:: { sym, Symbol , SymbolStr } ;
22+ use rustc_span:: symbol:: { sym, SymbolStr } ;
2323
2424use crate :: consts:: { constant, Constant } ;
2525use crate :: utils:: usage:: mutated_variables;
@@ -2111,7 +2111,7 @@ fn lint_iter_cloned_collect<'a, 'tcx>(
21112111 iter_args : & ' tcx [ hir:: Expr < ' _ > ] ,
21122112) {
21132113 if_chain ! {
2114- if is_type_diagnostic_item( cx, cx. tables. expr_ty( expr) , Symbol :: intern ( " vec_type" ) ) ;
2114+ if is_type_diagnostic_item( cx, cx. tables. expr_ty( expr) , sym! ( vec_type) ) ;
21152115 if let Some ( slice) = derefs_to_slice( cx, & iter_args[ 0 ] , cx. tables. expr_ty( & iter_args[ 0 ] ) ) ;
21162116 if let Some ( to_replace) = expr. span. trim_start( slice. span. source_callsite( ) ) ;
21172117
@@ -2240,7 +2240,7 @@ fn lint_iter_nth<'a, 'tcx>(
22402240 let mut_str = if is_mut { "_mut" } else { "" } ;
22412241 let caller_type = if derefs_to_slice ( cx, & iter_args[ 0 ] , cx. tables . expr_ty ( & iter_args[ 0 ] ) ) . is_some ( ) {
22422242 "slice"
2243- } else if is_type_diagnostic_item ( cx, cx. tables . expr_ty ( & iter_args[ 0 ] ) , Symbol :: intern ( " vec_type" ) ) {
2243+ } else if is_type_diagnostic_item ( cx, cx. tables . expr_ty ( & iter_args[ 0 ] ) , sym ! ( vec_type) ) {
22442244 "Vec"
22452245 } else if match_type ( cx, cx. tables . expr_ty ( & iter_args[ 0 ] ) , & paths:: VEC_DEQUE ) {
22462246 "VecDeque"
@@ -2297,7 +2297,7 @@ fn lint_get_unwrap<'a, 'tcx>(
22972297 let caller_type = if derefs_to_slice ( cx, & get_args[ 0 ] , expr_ty) . is_some ( ) {
22982298 needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ;
22992299 "slice"
2300- } else if is_type_diagnostic_item ( cx, expr_ty, Symbol :: intern ( " vec_type" ) ) {
2300+ } else if is_type_diagnostic_item ( cx, expr_ty, sym ! ( vec_type) ) {
23012301 needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ;
23022302 "Vec"
23032303 } else if match_type ( cx, expr_ty, & paths:: VEC_DEQUE ) {
@@ -2378,7 +2378,7 @@ fn derefs_to_slice<'a, 'tcx>(
23782378 match ty. kind {
23792379 ty:: Slice ( _) => true ,
23802380 ty:: Adt ( def, _) if def. is_box ( ) => may_slice ( cx, ty. boxed_ty ( ) ) ,
2381- ty:: Adt ( ..) => is_type_diagnostic_item ( cx, ty, Symbol :: intern ( " vec_type" ) ) ,
2381+ ty:: Adt ( ..) => is_type_diagnostic_item ( cx, ty, sym ! ( vec_type) ) ,
23822382 ty:: Array ( _, size) => {
23832383 if let Some ( size) = size. try_eval_usize ( cx. tcx , cx. param_env ) {
23842384 size < 32
0 commit comments