@@ -497,18 +497,17 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash
497
497
static KNOWN_WRAPPER_TYS : & [ & [ & str ] ] = & [ & [ "alloc" , "rc" , "Rc" ] , & [ "std" , "sync" , "Arc" ] ] ;
498
498
499
499
fn is_mutable_ty < ' a , ' tcx > ( cx : & LateContext < ' a , ' tcx > , ty : Ty < ' tcx > , span : Span , tys : & mut FxHashSet < DefId > ) -> bool {
500
- use ty:: TyKind :: { Adt , Array , Bool , Char , Float , Int , RawPtr , Ref , Slice , Str , Tuple , Uint } ;
501
500
match ty. kind {
502
501
// primitive types are never mutable
503
- Bool | Char | Int ( _) | Uint ( _) | Float ( _) | Str => false ,
504
- Adt ( ref adt, ref substs) => {
502
+ ty :: Bool | ty :: Char | ty :: Int ( _) | ty :: Uint ( _) | ty :: Float ( _) | ty :: Str => false ,
503
+ ty :: Adt ( ref adt, ref substs) => {
505
504
tys. insert ( adt. did ) && !ty. is_freeze ( cx. tcx , cx. param_env , span)
506
505
|| KNOWN_WRAPPER_TYS . iter ( ) . any ( |path| match_def_path ( cx, adt. did , path) )
507
506
&& substs. types ( ) . any ( |ty| is_mutable_ty ( cx, ty, span, tys) )
508
507
} ,
509
- Tuple ( ref substs) => substs. types ( ) . any ( |ty| is_mutable_ty ( cx, ty, span, tys) ) ,
510
- Array ( ty, _) | Slice ( ty) => is_mutable_ty ( cx, ty, span, tys) ,
511
- RawPtr ( ty:: TypeAndMut { ty, mutbl } ) | Ref ( _, ty, mutbl) => {
508
+ ty :: Tuple ( ref substs) => substs. types ( ) . any ( |ty| is_mutable_ty ( cx, ty, span, tys) ) ,
509
+ ty :: Array ( ty, _) | ty :: Slice ( ty) => is_mutable_ty ( cx, ty, span, tys) ,
510
+ ty :: RawPtr ( ty:: TypeAndMut { ty, mutbl } ) | ty :: Ref ( _, ty, mutbl) => {
512
511
mutbl == hir:: Mutability :: Mut || is_mutable_ty ( cx, ty, span, tys)
513
512
} ,
514
513
// calling something constitutes a side effect, so return true on all callables
0 commit comments