1
Fork 0

Rename ClearCrossCrate::assert_crate_local.

As `unwrap_crate_local`, because it follows exactly the standard form of
an `unwrap` function.
This commit is contained in:
Nicholas Nethercote 2025-02-13 14:00:39 +11:00
parent 2f695dc64e
commit 5d2d11fd5d
12 changed files with 15 additions and 15 deletions

View file

@ -142,7 +142,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// Overwrite temp local info if we have something more interesting to record.
if !matches!(local_info, LocalInfo::Boring) {
let decl_info =
this.local_decls[operand].local_info.as_mut().assert_crate_local();
this.local_decls[operand].local_info.as_mut().unwrap_crate_local();
if let LocalInfo::Boring | LocalInfo::BlockTailTemp(_) = **decl_info {
**decl_info = local_info;
}

View file

@ -85,7 +85,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
_ => LocalInfo::Boring,
};
**local_decl.local_info.as_mut().assert_crate_local() = local_info;
**local_decl.local_info.as_mut().unwrap_crate_local() = local_info;
this.local_decls.push(local_decl)
};
debug!(?temp);

View file

@ -722,7 +722,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
if let LocalInfo::User(BindingForm::Var(VarBindingForm {
opt_match_place: Some((ref mut match_place, _)),
..
})) = **self.local_decls[local].local_info.as_mut().assert_crate_local()
})) = **self.local_decls[local].local_info.as_mut().unwrap_crate_local()
{
*match_place = Some(place);
} else {

View file

@ -967,7 +967,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
} => {
self.local_decls[local].mutability = mutability;
self.local_decls[local].source_info.scope = self.source_scope;
**self.local_decls[local].local_info.as_mut().assert_crate_local() =
**self.local_decls[local].local_info.as_mut().unwrap_crate_local() =
if let Some(kind) = param.self_kind {
LocalInfo::User(BindingForm::ImplicitSelf(kind))
} else {
@ -1032,7 +1032,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let parent_id = self.source_scopes[original_source_scope]
.local_data
.as_ref()
.assert_crate_local()
.unwrap_crate_local()
.lint_root;
self.maybe_new_source_scope(pattern_span, arg_hir_id, parent_id);
}

View file

@ -604,7 +604,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let source_scope = self.source_scope;
if let LintLevel::Explicit(current_hir_id) = lint_level {
let parent_id =
self.source_scopes[source_scope].local_data.as_ref().assert_crate_local().lint_root;
self.source_scopes[source_scope].local_data.as_ref().unwrap_crate_local().lint_root;
self.maybe_new_source_scope(region_scope.1.span, current_hir_id, parent_id);
}
self.push_scope(region_scope);
@ -992,7 +992,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
lint_root: if let LintLevel::Explicit(lint_root) = lint_level {
lint_root
} else {
self.source_scopes[parent].local_data.as_ref().assert_crate_local().lint_root
self.source_scopes[parent].local_data.as_ref().unwrap_crate_local().lint_root
},
};
self.source_scopes.push(SourceScopeData {