@@ -19,7 +19,7 @@ use rustc_middle::ty::subst::GenericArgKind;
19
19
use rustc_middle:: ty:: { self , Predicate , Ty } ;
20
20
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
21
21
use rustc_span:: source_map:: Span ;
22
- use rustc_span:: symbol:: { sym, Symbol , SymbolStr } ;
22
+ use rustc_span:: symbol:: { sym, SymbolStr } ;
23
23
24
24
use crate :: consts:: { constant, Constant } ;
25
25
use crate :: utils:: usage:: mutated_variables;
@@ -2089,7 +2089,7 @@ fn lint_iter_cloned_collect<'a, 'tcx>(
2089
2089
iter_args : & ' tcx [ hir:: Expr < ' _ > ] ,
2090
2090
) {
2091
2091
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) ) ;
2093
2093
if let Some ( slice) = derefs_to_slice( cx, & iter_args[ 0 ] , cx. tables. expr_ty( & iter_args[ 0 ] ) ) ;
2094
2094
if let Some ( to_replace) = expr. span. trim_start( slice. span. source_callsite( ) ) ;
2095
2095
@@ -2218,7 +2218,7 @@ fn lint_iter_nth<'a, 'tcx>(
2218
2218
let mut_str = if is_mut { "_mut" } else { "" } ;
2219
2219
let caller_type = if derefs_to_slice ( cx, & iter_args[ 0 ] , cx. tables . expr_ty ( & iter_args[ 0 ] ) ) . is_some ( ) {
2220
2220
"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) ) {
2222
2222
"Vec"
2223
2223
} else if match_type ( cx, cx. tables . expr_ty ( & iter_args[ 0 ] ) , & paths:: VEC_DEQUE ) {
2224
2224
"VecDeque"
@@ -2275,7 +2275,7 @@ fn lint_get_unwrap<'a, 'tcx>(
2275
2275
let caller_type = if derefs_to_slice ( cx, & get_args[ 0 ] , expr_ty) . is_some ( ) {
2276
2276
needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ;
2277
2277
"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) ) {
2279
2279
needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ;
2280
2280
"Vec"
2281
2281
} else if match_type ( cx, expr_ty, & paths:: VEC_DEQUE ) {
@@ -2356,7 +2356,7 @@ fn derefs_to_slice<'a, 'tcx>(
2356
2356
match ty. kind {
2357
2357
ty:: Slice ( _) => true ,
2358
2358
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) ) ,
2360
2360
ty:: Array ( _, size) => {
2361
2361
if let Some ( size) = size. try_eval_usize ( cx. tcx , cx. param_env ) {
2362
2362
size < 32
0 commit comments