@@ -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;
@@ -2111,7 +2111,7 @@ fn lint_iter_cloned_collect<'a, 'tcx>(
2111
2111
iter_args : & ' tcx [ hir:: Expr < ' _ > ] ,
2112
2112
) {
2113
2113
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) ) ;
2115
2115
if let Some ( slice) = derefs_to_slice( cx, & iter_args[ 0 ] , cx. tables. expr_ty( & iter_args[ 0 ] ) ) ;
2116
2116
if let Some ( to_replace) = expr. span. trim_start( slice. span. source_callsite( ) ) ;
2117
2117
@@ -2240,7 +2240,7 @@ fn lint_iter_nth<'a, 'tcx>(
2240
2240
let mut_str = if is_mut { "_mut" } else { "" } ;
2241
2241
let caller_type = if derefs_to_slice ( cx, & iter_args[ 0 ] , cx. tables . expr_ty ( & iter_args[ 0 ] ) ) . is_some ( ) {
2242
2242
"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) ) {
2244
2244
"Vec"
2245
2245
} else if match_type ( cx, cx. tables . expr_ty ( & iter_args[ 0 ] ) , & paths:: VEC_DEQUE ) {
2246
2246
"VecDeque"
@@ -2297,7 +2297,7 @@ fn lint_get_unwrap<'a, 'tcx>(
2297
2297
let caller_type = if derefs_to_slice ( cx, & get_args[ 0 ] , expr_ty) . is_some ( ) {
2298
2298
needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ;
2299
2299
"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) ) {
2301
2301
needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ;
2302
2302
"Vec"
2303
2303
} else if match_type ( cx, expr_ty, & paths:: VEC_DEQUE ) {
@@ -2378,7 +2378,7 @@ fn derefs_to_slice<'a, 'tcx>(
2378
2378
match ty. kind {
2379
2379
ty:: Slice ( _) => true ,
2380
2380
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) ) ,
2382
2382
ty:: Array ( _, size) => {
2383
2383
if let Some ( size) = size. try_eval_usize ( cx. tcx , cx. param_env ) {
2384
2384
size < 32
0 commit comments