Change DefKind::Static to a struct variant

This commit is contained in:
Oli Scherer 2024-02-23 23:12:20 +00:00
parent 6c863bc64c
commit b205192f65
4 changed files with 5 additions and 5 deletions

View File

@ -273,7 +273,7 @@ fn check(&mut self, idx: &'tcx Expr<'_>, seqexpr: &'tcx Expr<'_>, expr: &'tcx Ex
} }
return false; // no need to walk further *on the variable* return false; // no need to walk further *on the variable*
}, },
Res::Def(DefKind::Static(_) | DefKind::Const, ..) => { Res::Def(DefKind::Static{..} | DefKind::Const, ..) => {
if index_used_directly { if index_used_directly {
self.indexed_directly.insert( self.indexed_directly.insert(
seqvar.segments[0].ident.name, seqvar.segments[0].ident.name,

View File

@ -101,7 +101,7 @@ fn insert_def_id(&mut self, ex: &'tcx Expr<'_>) {
Res::Local(hir_id) => { Res::Local(hir_id) => {
self.ids.insert(hir_id); self.ids.insert(hir_id);
}, },
Res::Def(DefKind::Static(_), def_id) => { Res::Def(DefKind::Static{..}, def_id) => {
let mutable = self.cx.tcx.is_mutable_static(def_id); let mutable = self.cx.tcx.is_mutable_static(def_id);
self.def_ids.insert(def_id, mutable); self.def_ids.insert(def_id, mutable);
}, },

View File

@ -91,7 +91,7 @@ fn can_be_static_str(cx: &LateContext<'_>, arg: &hir::Expr<'_>) -> bool {
}, },
hir::ExprKind::Path(ref p) => matches!( hir::ExprKind::Path(ref p) => matches!(
cx.qpath_res(p, arg.hir_id), cx.qpath_res(p, arg.hir_id),
hir::def::Res::Def(hir::def::DefKind::Const | hir::def::DefKind::Static(_), _) hir::def::Res::Def(hir::def::DefKind::Const | hir::def::DefKind::Static{..}, _)
), ),
_ => false, _ => false,
} }

View File

@ -109,7 +109,7 @@ fn collect_unsafe_exprs<'tcx>(
ExprKind::Path(QPath::Resolved( ExprKind::Path(QPath::Resolved(
_, _,
hir::Path { hir::Path {
res: Res::Def(DefKind::Static(Mutability::Mut), _), res: Res::Def(DefKind::Static{mt:Mutability::Mut}, _),
.. ..
}, },
)) => { )) => {
@ -149,7 +149,7 @@ fn collect_unsafe_exprs<'tcx>(
ExprKind::Path(QPath::Resolved( ExprKind::Path(QPath::Resolved(
_, _,
hir::Path { hir::Path {
res: Res::Def(DefKind::Static(Mutability::Mut), _), res: Res::Def(DefKind::Static{mt:Mutability::Mut}, _),
.. ..
} }
)) ))