Skip to content

Commit cc907f8

Browse files
committedJul 13, 2023
Re-format let-else per rustfmt update
1 parent 67b0cfc commit cc907f8

File tree

162 files changed

+1407
-950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+1407
-950
lines changed
 

‎compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
352352

353353
let idx2 = *o.get();
354354
let (ref op2, op_sp2) = operands[idx2];
355-
let Some(asm::InlineAsmRegOrRegClass::Reg(reg2)) = op2.reg() else {
355+
let Some(asm::InlineAsmRegOrRegClass::Reg(reg2)) = op2.reg()
356+
else {
356357
unreachable!();
357358
};
358359

@@ -368,7 +369,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
368369
assert!(!*late);
369370
let out_op_sp = if input { op_sp2 } else { op_sp };
370371
Some(out_op_sp)
371-
},
372+
}
372373
_ => None,
373374
};
374375

@@ -377,7 +378,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
377378
op_span2: op_sp2,
378379
reg1_name: reg.name(),
379380
reg2_name: reg2.name(),
380-
in_out
381+
in_out,
381382
});
382383
}
383384
Entry::Vacant(v) => {

‎compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
714714
_ => None,
715715
};
716716

717-
let Some(borrow_level) = borrow_level else { return false; };
717+
let Some(borrow_level) = borrow_level else {
718+
return false;
719+
};
718720
let sugg = move_sites
719721
.iter()
720722
.map(|move_site| {
@@ -763,7 +765,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
763765
.typeck_root_def_id(self.mir_def_id().to_def_id())
764766
.as_local()
765767
.and_then(|def_id| tcx.hir().get_generics(def_id))
766-
else { return; };
768+
else {
769+
return;
770+
};
767771
// Try to find predicates on *generic params* that would allow copying `ty`
768772
let ocx = ObligationCtxt::new(&self.infcx);
769773
let copy_did = tcx.require_lang_item(LangItem::Copy, Some(span));
@@ -1220,18 +1224,20 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12201224
return;
12211225
};
12221226
let inner_param_uses = find_all_local_uses::find(self.body, inner_param.local);
1223-
let Some((inner_call_loc, inner_call_term)) = inner_param_uses.into_iter().find_map(|loc| {
1224-
let Either::Right(term) = self.body.stmt_at(loc) else {
1225-
debug!("{:?} is a statement, so it can't be a call", loc);
1226-
return None;
1227-
};
1228-
let TerminatorKind::Call { args, .. } = &term.kind else {
1229-
debug!("not a call: {:?}", term);
1230-
return None;
1231-
};
1232-
debug!("checking call args for uses of inner_param: {:?}", args);
1233-
args.contains(&Operand::Move(inner_param)).then_some((loc, term))
1234-
}) else {
1227+
let Some((inner_call_loc, inner_call_term)) =
1228+
inner_param_uses.into_iter().find_map(|loc| {
1229+
let Either::Right(term) = self.body.stmt_at(loc) else {
1230+
debug!("{:?} is a statement, so it can't be a call", loc);
1231+
return None;
1232+
};
1233+
let TerminatorKind::Call { args, .. } = &term.kind else {
1234+
debug!("not a call: {:?}", term);
1235+
return None;
1236+
};
1237+
debug!("checking call args for uses of inner_param: {:?}", args);
1238+
args.contains(&Operand::Move(inner_param)).then_some((loc, term))
1239+
})
1240+
else {
12351241
debug!("no uses of inner_param found as a by-move call arg");
12361242
return;
12371243
};
@@ -1442,21 +1448,24 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14421448
}
14431449

14441450
// Get closure's arguments
1445-
let ty::Closure(_, substs) = typeck_results.expr_ty(closure_expr).kind() else { /* hir::Closure can be a generator too */ return };
1451+
let ty::Closure(_, substs) = typeck_results.expr_ty(closure_expr).kind() else {
1452+
/* hir::Closure can be a generator too */
1453+
return;
1454+
};
14461455
let sig = substs.as_closure().sig();
14471456
let tupled_params =
14481457
tcx.erase_late_bound_regions(sig.inputs().iter().next().unwrap().map_bound(|&b| b));
14491458
let ty::Tuple(params) = tupled_params.kind() else { return };
14501459

14511460
// Find the first argument with a matching type, get its name
1452-
let Some((_, this_name)) = params
1453-
.iter()
1454-
.zip(hir.body_param_names(closure.body))
1455-
.find(|(param_ty, name)|{
1461+
let Some((_, this_name)) =
1462+
params.iter().zip(hir.body_param_names(closure.body)).find(|(param_ty, name)| {
14561463
// FIXME: also support deref for stuff like `Rc` arguments
14571464
param_ty.peel_refs() == local_ty && name != &Ident::empty()
14581465
})
1459-
else { return };
1466+
else {
1467+
return;
1468+
};
14601469

14611470
let spans;
14621471
if let Some((_path_expr, qpath)) = finder.error_path
@@ -2899,7 +2908,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
28992908
{
29002909
let def_id = def_id.expect_local();
29012910
for operand in operands {
2902-
let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand else {
2911+
let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) =
2912+
operand
2913+
else {
29032914
continue;
29042915
};
29052916
debug!(
@@ -2908,7 +2919,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
29082919
);
29092920

29102921
// Find the local from the operand.
2911-
let Some(assigned_from_local) = assigned_from.local_or_deref_local() else {
2922+
let Some(assigned_from_local) =
2923+
assigned_from.local_or_deref_local()
2924+
else {
29122925
continue;
29132926
};
29142927

@@ -2961,7 +2974,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
29612974
);
29622975

29632976
// Find the local from the rvalue.
2964-
let Some(assigned_from_local) = assigned_from.local_or_deref_local() else { continue };
2977+
let Some(assigned_from_local) = assigned_from.local_or_deref_local() else {
2978+
continue;
2979+
};
29652980
debug!(
29662981
"annotate_argument_and_return_for_borrow: \
29672982
assigned_from_local={:?}",
@@ -3009,7 +3024,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
30093024
assigned_to, args
30103025
);
30113026
for operand in args {
3012-
let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand else {
3027+
let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand
3028+
else {
30133029
continue;
30143030
};
30153031
debug!(

0 commit comments

Comments
 (0)