@@ -1756,7 +1756,7 @@ fn lint_expect_fun_call(
17561756                        && { 
17571757                            let  arg_type = cx. tables . expr_ty ( & call_args[ 0 ] ) ; 
17581758                            let  base_type = walk_ptrs_ty ( arg_type) ; 
1759-                             base_type. kind  == ty:: Str  || match_type ( cx,  base_type,  & paths :: STRING ) 
1759+                             base_type. kind  == ty:: Str  || is_type_diagnostic_item ( cx,  base_type,  sym ! ( string_type ) ) 
17601760                        } 
17611761                    { 
17621762                        & call_args[ 0 ] 
@@ -1774,7 +1774,7 @@ fn lint_expect_fun_call(
17741774    // converted to string. 
17751775    fn  requires_to_string ( cx :  & LateContext < ' _ ,  ' _ > ,  arg :  & hir:: Expr < ' _ > )  -> bool  { 
17761776        let  arg_ty = cx. tables . expr_ty ( arg) ; 
1777-         if  match_type ( cx,  arg_ty,  & paths :: STRING )  { 
1777+         if  is_type_diagnostic_item ( cx,  arg_ty,  sym ! ( string_type ) )  { 
17781778            return  false ; 
17791779        } 
17801780        if  let  ty:: Ref ( _,  ty,  ..)  = arg_ty. kind  { 
@@ -2054,7 +2054,7 @@ fn lint_string_extend(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, args: &[hi
20542054        let  self_ty = walk_ptrs_ty ( cx. tables . expr_ty ( target) ) ; 
20552055        let  ref_str = if  self_ty. kind  == ty:: Str  { 
20562056            "" 
2057-         }  else  if  match_type ( cx,  self_ty,  & paths :: STRING )  { 
2057+         }  else  if  is_type_diagnostic_item ( cx,  self_ty,  sym ! ( string_type ) )  { 
20582058            "&" 
20592059        }  else  { 
20602060            return ; 
@@ -2080,7 +2080,7 @@ fn lint_string_extend(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, args: &[hi
20802080
20812081fn  lint_extend ( cx :  & LateContext < ' _ ,  ' _ > ,  expr :  & hir:: Expr < ' _ > ,  args :  & [ hir:: Expr < ' _ > ] )  { 
20822082    let  obj_ty = walk_ptrs_ty ( cx. tables . expr_ty ( & args[ 0 ] ) ) ; 
2083-     if  match_type ( cx,  obj_ty,  & paths :: STRING )  { 
2083+     if  is_type_diagnostic_item ( cx,  obj_ty,  sym ! ( string_type ) )  { 
20842084        lint_string_extend ( cx,  expr,  args) ; 
20852085    } 
20862086} 
@@ -2242,7 +2242,7 @@ fn lint_iter_nth<'a, 'tcx>(
22422242        "slice" 
22432243    }  else  if  is_type_diagnostic_item ( cx,  cx. tables . expr_ty ( & iter_args[ 0 ] ) ,  sym ! ( vec_type) )  { 
22442244        "Vec" 
2245-     }  else  if  match_type ( cx,  cx. tables . expr_ty ( & iter_args[ 0 ] ) ,  & paths :: VEC_DEQUE )  { 
2245+     }  else  if  is_type_diagnostic_item ( cx,  cx. tables . expr_ty ( & iter_args[ 0 ] ) ,  sym ! ( vecdeque_type ) )  { 
22462246        "VecDeque" 
22472247    }  else  { 
22482248        let  nth_args = nth_and_iter_args[ 0 ] ; 
@@ -2301,10 +2301,10 @@ fn lint_get_unwrap<'a, 'tcx>(
23012301    }  else  if  is_type_diagnostic_item ( cx,  expr_ty,  sym ! ( vec_type) )  { 
23022302        needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ; 
23032303        "Vec" 
2304-     }  else  if  match_type ( cx,  expr_ty,  & paths :: VEC_DEQUE )  { 
2304+     }  else  if  is_type_diagnostic_item ( cx,  expr_ty,  sym ! ( vecdeque_type ) )  { 
23052305        needs_ref = get_args_str. parse :: < usize > ( ) . is_ok ( ) ; 
23062306        "VecDeque" 
2307-     }  else  if  !is_mut && match_type ( cx,  expr_ty,  & paths :: HASHMAP )  { 
2307+     }  else  if  !is_mut && is_type_diagnostic_item ( cx,  expr_ty,  sym ! ( hashmap_type ) )  { 
23082308        needs_ref = true ; 
23092309        "HashMap" 
23102310    }  else  if  !is_mut && match_type ( cx,  expr_ty,  & paths:: BTREEMAP )  { 
@@ -2510,7 +2510,7 @@ fn lint_map_flatten<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr<
25102510    } 
25112511
25122512    // lint if caller of `.map().flatten()` is an Option 
2513-     if  match_type ( cx,  cx. tables . expr_ty ( & map_args[ 0 ] ) ,  & paths :: OPTION )  { 
2513+     if  is_type_diagnostic_item ( cx,  cx. tables . expr_ty ( & map_args[ 0 ] ) ,  sym ! ( option_type ) )  { 
25142514        let  msg = "called `map(..).flatten()` on an `Option`. \  
25152515; 
25162516        let  self_snippet = snippet ( cx,  map_args[ 0 ] . span ,  ".." ) ; 
@@ -2678,7 +2678,7 @@ fn lint_option_and_then_some(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, arg
26782678    const  NO_OP_MSG :  & str  = "using `Option.and_then(Some)`, which is a no-op" ; 
26792679
26802680    let  ty = cx. tables . expr_ty ( & args[ 0 ] ) ; 
2681-     if  !match_type ( cx,  ty,  & paths :: OPTION )  { 
2681+     if  !is_type_diagnostic_item ( cx,  ty,  sym ! ( option_type ) )  { 
26822682        return ; 
26832683    } 
26842684
@@ -3282,7 +3282,7 @@ fn lint_option_as_ref_deref<'a, 'tcx>(
32823282    let  same_mutability = |m| ( is_mut && m == & hir:: Mutability :: Mut )  || ( !is_mut && m == & hir:: Mutability :: Not ) ; 
32833283
32843284    let  option_ty = cx. tables . expr_ty ( & as_ref_args[ 0 ] ) ; 
3285-     if  !match_type ( cx,  option_ty,  & paths :: OPTION )  { 
3285+     if  !is_type_diagnostic_item ( cx,  option_ty,  sym ! ( option_type ) )  { 
32863286        return ; 
32873287    } 
32883288
0 commit comments