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:
Matthias Krüger 2022-02-21 19:36:48 +01:00 committed by GitHub
commit ea7f7f7c4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 86 additions and 123 deletions

View file

@ -851,12 +851,9 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
// to reject those pointers, we just do not have the machinery to
// talk about parts of a pointer.
// We also accept uninit, for consistency with the slow path.
let alloc = match self.ecx.memory.get(mplace.ptr, size, mplace.align)? {
Some(a) => a,
None => {
// Size 0, nothing more to check.
return Ok(());
}
let Some(alloc) = self.ecx.memory.get(mplace.ptr, size, mplace.align)? else {
// Size 0, nothing more to check.
return Ok(());
};
let allow_uninit_and_ptr = !M::enforce_number_validity(self.ecx);