11use rustc_ast:: ast:: Attribute ;
2- use rustc_data_structures:: fx:: FxHashSet ;
32use rustc_errors:: Applicability ;
4- use rustc_hir:: { self as hir, def:: Res , def_id:: DefId , intravisit, QPath } ;
3+ use rustc_hir:: def_id:: DefIdSet ;
4+ use rustc_hir:: { self as hir, def:: Res , intravisit, QPath } ;
55use rustc_lint:: { LateContext , LintContext } ;
66use rustc_middle:: {
77 hir:: map:: Map ,
@@ -169,11 +169,11 @@ fn returns_unit(decl: &hir::FnDecl<'_>) -> bool {
169169}
170170
171171fn has_mutable_arg ( cx : & LateContext < ' _ > , body : & hir:: Body < ' _ > ) -> bool {
172- let mut tys = FxHashSet :: default ( ) ;
172+ let mut tys = DefIdSet :: default ( ) ;
173173 body. params . iter ( ) . any ( |param| is_mutable_pat ( cx, & param. pat , & mut tys) )
174174}
175175
176- fn is_mutable_pat ( cx : & LateContext < ' _ > , pat : & hir:: Pat < ' _ > , tys : & mut FxHashSet < DefId > ) -> bool {
176+ fn is_mutable_pat ( cx : & LateContext < ' _ > , pat : & hir:: Pat < ' _ > , tys : & mut DefIdSet ) -> bool {
177177 if let hir:: PatKind :: Wild = pat. kind {
178178 return false ; // ignore `_` patterns
179179 }
@@ -186,7 +186,7 @@ fn is_mutable_pat(cx: &LateContext<'_>, pat: &hir::Pat<'_>, tys: &mut FxHashSet<
186186
187187static KNOWN_WRAPPER_TYS : & [ & [ & str ] ] = & [ & [ "alloc" , "rc" , "Rc" ] , & [ "std" , "sync" , "Arc" ] ] ;
188188
189- fn is_mutable_ty < ' tcx > ( cx : & LateContext < ' tcx > , ty : Ty < ' tcx > , span : Span , tys : & mut FxHashSet < DefId > ) -> bool {
189+ fn is_mutable_ty < ' tcx > ( cx : & LateContext < ' tcx > , ty : Ty < ' tcx > , span : Span , tys : & mut DefIdSet ) -> bool {
190190 match * ty. kind ( ) {
191191 // primitive types are never mutable
192192 ty:: Bool | ty:: Char | ty:: Int ( _) | ty:: Uint ( _) | ty:: Float ( _) | ty:: Str => false ,
@@ -222,7 +222,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
222222 }
223223 match expr. kind {
224224 Call ( _, args) | MethodCall ( _, _, args, _) => {
225- let mut tys = FxHashSet :: default ( ) ;
225+ let mut tys = DefIdSet :: default ( ) ;
226226 for arg in args {
227227 if self . cx . tcx . has_typeck_results ( arg. hir_id . owner . to_def_id ( ) )
228228 && is_mutable_ty (
0 commit comments