@@ -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;
@@ -2089,7 +2089,7 @@ fn lint_iter_cloned_collect<'a, 'tcx>(
20892089 iter_args : & ' tcx [ hir:: Expr < ' _ > ] ,
20902090) {
20912091 if_chain ! {
2092- if is_type_diagnostic_item( cx, cx. tables. expr_ty( expr) , Symbol :: intern ( " vec_type" ) ) ;
2092+ if is_type_diagnostic_item( cx, cx. tables. expr_ty( expr) , sym! ( vec_type) ) ;
20932093 if let Some ( slice) = derefs_to_slice( cx, & iter_args[ 0 ] , cx. tables. expr_ty( & iter_args[ 0 ] ) ) ;
20942094 if let Some ( to_replace) = expr. span. trim_start( slice. span. source_callsite( ) ) ;
20952095
@@ -2218,7 +2218,7 @@ fn lint_iter_nth<'a, 'tcx>(
22182218 let mut_str = if is_mut { "_mut" } else { "" } ;
22192219 let caller_type = if derefs_to_slice ( cx, & iter_args[ 0 ] , cx. tables . expr_ty ( & iter_args[ 0 ] ) ) . is_some ( ) {
22202220 "slice"
2221- } else if is_type_diagnostic_item ( cx, cx. tables . expr_ty ( & iter_args[ 0 ] ) , Symbol :: intern ( " vec_type" ) ) {
2221+ } else if is_type_diagnostic_item ( cx, cx. tables . expr_ty ( & iter_args[ 0 ] ) , sym ! ( vec_type) ) {
22222222 "Vec"
22232223 } else if match_type ( cx, cx. tables . expr_ty ( & iter_args[ 0 ] ) , & paths:: VEC_DEQUE ) {
22242224 "VecDeque"
@@ -2275,7 +2275,7 @@ fn lint_get_unwrap<'a, 'tcx>(
22752275 let caller_type = if derefs_to_slice ( cx, & get_args[ 0 ] , expr_ty) . is_some ( ) {
22762276 needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ;
22772277 "slice"
2278- } else if is_type_diagnostic_item ( cx, expr_ty, Symbol :: intern ( " vec_type" ) ) {
2278+ } else if is_type_diagnostic_item ( cx, expr_ty, sym ! ( vec_type) ) {
22792279 needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ;
22802280 "Vec"
22812281 } else if match_type ( cx, expr_ty, & paths:: VEC_DEQUE ) {
@@ -2356,7 +2356,7 @@ fn derefs_to_slice<'a, 'tcx>(
23562356 match ty. kind {
23572357 ty:: Slice ( _) => true ,
23582358 ty:: Adt ( def, _) if def. is_box ( ) => may_slice ( cx, ty. boxed_ty ( ) ) ,
2359- ty:: Adt ( ..) => is_type_diagnostic_item ( cx, ty, Symbol :: intern ( " vec_type" ) ) ,
2359+ ty:: Adt ( ..) => is_type_diagnostic_item ( cx, ty, sym ! ( vec_type) ) ,
23602360 ty:: Array ( _, size) => {
23612361 if let Some ( size) = size. try_eval_usize ( cx. tcx , cx. param_env ) {
23622362 size < 32
0 commit comments