Rollup merge of #94143 - est31:let_else_const_eval, r=lcnr
rustc_const_eval: 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 PR handles rustc_const_eval.
This commit is contained in:
@@ -134,11 +134,8 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
|
||||
.find(|(_, block)| matches!(block.terminator().kind, TerminatorKind::Return))
|
||||
.map(|(bb, _)| bb);
|
||||
|
||||
let return_block = match return_block {
|
||||
None => {
|
||||
return qualifs::in_any_value_of_ty(ccx, ccx.body.return_ty(), tainted_by_errors);
|
||||
}
|
||||
Some(bb) => bb,
|
||||
let Some(return_block) = return_block else {
|
||||
return qualifs::in_any_value_of_ty(ccx, ccx.body.return_ty(), tainted_by_errors);
|
||||
};
|
||||
|
||||
let return_loc = ccx.body.terminator_loc(return_block);
|
||||
|
||||
@@ -747,15 +747,12 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
|
||||
if loc.statement_index < num_stmts {
|
||||
let (mut rvalue, source_info) = {
|
||||
let statement = &mut self.source[loc.block].statements[loc.statement_index];
|
||||
let rhs = match statement.kind {
|
||||
StatementKind::Assign(box (_, ref mut rhs)) => rhs,
|
||||
_ => {
|
||||
span_bug!(
|
||||
statement.source_info.span,
|
||||
"{:?} is not an assignment",
|
||||
statement
|
||||
);
|
||||
}
|
||||
let StatementKind::Assign(box (_, ref mut rhs)) = statement.kind else {
|
||||
span_bug!(
|
||||
statement.source_info.span,
|
||||
"{:?} is not an assignment",
|
||||
statement
|
||||
);
|
||||
};
|
||||
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user