Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f2d6770

Browse files
authoredFeb 19, 2022
Rollup merge of #94146 - est31:let_else, r=cjgillot
Adopt let else in more places Continuation of #89933, #91018, #91481, #93046, #93590, #94011. I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This is the biggest of these PRs and handles the changes outside of rustdoc, rustc_typeck, rustc_const_eval, rustc_trait_selection, which were handled in PRs #94139, #94142, #94143, #94144.
2 parents 7ca1c48 + 2ef8af6 commit f2d6770

File tree

132 files changed

+539
-881
lines changed

Some content is hidden

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

132 files changed

+539
-881
lines changed
 

‎compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
339339

340340
let idx2 = *o.get();
341341
let &(ref op2, op_sp2) = &operands[idx2];
342-
let reg2 = match op2.reg() {
343-
Some(asm::InlineAsmRegOrRegClass::Reg(r)) => r,
344-
_ => unreachable!(),
342+
let Some(asm::InlineAsmRegOrRegClass::Reg(reg2)) = op2.reg() else {
343+
unreachable!();
345344
};
346345

347346
let msg = format!(

‎compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
330330
args: Vec<AstP<Expr>>,
331331
legacy_args_idx: &[usize],
332332
) -> hir::ExprKind<'hir> {
333-
let path = match f.kind {
334-
ExprKind::Path(None, ref mut path) => path,
335-
_ => unreachable!(),
333+
let ExprKind::Path(None, ref mut path) = f.kind else {
334+
unreachable!();
336335
};
337336

338337
// Split the arguments into const generics and normal arguments

0 commit comments

Comments
 (0)