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.
This commit is contained in:
commit
f2d6770f77
132 changed files with 539 additions and 881 deletions
|
@ -339,9 +339,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
|
||||
let idx2 = *o.get();
|
||||
let &(ref op2, op_sp2) = &operands[idx2];
|
||||
let reg2 = match op2.reg() {
|
||||
Some(asm::InlineAsmRegOrRegClass::Reg(r)) => r,
|
||||
_ => unreachable!(),
|
||||
let Some(asm::InlineAsmRegOrRegClass::Reg(reg2)) = op2.reg() else {
|
||||
unreachable!();
|
||||
};
|
||||
|
||||
let msg = format!(
|
||||
|
|
|
@ -330,9 +330,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
args: Vec<AstP<Expr>>,
|
||||
legacy_args_idx: &[usize],
|
||||
) -> hir::ExprKind<'hir> {
|
||||
let path = match f.kind {
|
||||
ExprKind::Path(None, ref mut path) => path,
|
||||
_ => unreachable!(),
|
||||
let ExprKind::Path(None, ref mut path) = f.kind else {
|
||||
unreachable!();
|
||||
};
|
||||
|
||||
// Split the arguments into const generics and normal arguments
|
||||
|
|
|
@ -1376,9 +1376,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
// keep track of the Span info. Now, `add_implicitly_sized` in `AstConv` checks both param bounds and
|
||||
// where clauses for `?Sized`.
|
||||
for pred in &generics.where_clause.predicates {
|
||||
let bound_pred = match *pred {
|
||||
WherePredicate::BoundPredicate(ref bound_pred) => bound_pred,
|
||||
_ => continue,
|
||||
let WherePredicate::BoundPredicate(ref bound_pred) = *pred else {
|
||||
continue;
|
||||
};
|
||||
let compute_is_param = || {
|
||||
// Check if the where clause type is a plain type parameter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue