@@ -497,18 +497,17 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash
497497static KNOWN_WRAPPER_TYS : & [ & [ & str ] ] = & [ & [ "alloc" , "rc" , "Rc" ] , & [ "std" , "sync" , "Arc" ] ] ;
498498
499499fn 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 } ;
501500 match ty. kind {
502501 // 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) => {
505504 tys. insert ( adt. did ) && !ty. is_freeze ( cx. tcx , cx. param_env , span)
506505 || KNOWN_WRAPPER_TYS . iter ( ) . any ( |path| match_def_path ( cx, adt. did , path) )
507506 && substs. types ( ) . any ( |ty| is_mutable_ty ( cx, ty, span, tys) )
508507 } ,
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) => {
512511 mutbl == hir:: Mutability :: Mut || is_mutable_ty ( cx, ty, span, tys)
513512 } ,
514513 // calling something constitutes a side effect, so return true on all callables
0 commit comments