1
Fork 0

Adopt let else in more places

This commit is contained in:
est31 2022-02-19 00:48:49 +01:00
parent b8c56fa8c3
commit 2ef8af6619
132 changed files with 539 additions and 881 deletions

View file

@ -1413,22 +1413,16 @@ impl EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
impl<'tcx> Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) {
let lhs = match self.assigned_local {
Some(l) => l,
None => {
// This visitor only invokes `visit_place` for the right-hand side of an assignment
// and only after setting `self.assigned_local`. However, the default impl of
// `Visitor::super_body` may call `visit_place` with a `NonUseContext` for places
// with debuginfo. Ignore them here.
assert!(!context.is_use());
return;
}
let Some(lhs) = self.assigned_local else {
// This visitor only invokes `visit_place` for the right-hand side of an assignment
// and only after setting `self.assigned_local`. However, the default impl of
// `Visitor::super_body` may call `visit_place` with a `NonUseContext` for places
// with debuginfo. Ignore them here.
assert!(!context.is_use());
return;
};
let rhs = match self.saved_local_for_direct_place(*place) {
Some(l) => l,
None => return,
};
let Some(rhs) = self.saved_local_for_direct_place(*place) else { return };
if !self.storage_conflicts.contains(lhs, rhs) {
bug!(