1
Fork 0

Adopt let_else across the compiler

This performs a substitution of code following the pattern:

let <id> = if let <pat> = ... { identity } else { ... : ! };

To simplify it to:

let <pat> = ... { identity } else { ... : ! };

By adopting the let_else feature.
This commit is contained in:
est31 2021-10-16 03:45:14 +02:00
parent c1026539bd
commit 1418df5888
51 changed files with 69 additions and 137 deletions

View file

@ -174,9 +174,8 @@ pub fn each_linked_rlib(
_ => {}
}
}
let fmts = match fmts {
Some(f) => f,
None => return Err("could not find formats for rlibs".to_string()),
let Some(fmts) = fmts else {
return Err("could not find formats for rlibs".to_string());
};
for &cnum in crates {
match fmts.get(cnum.as_usize() - 1) {

View file

@ -3,6 +3,7 @@
#![feature(box_patterns)]
#![feature(try_blocks)]
#![feature(in_band_lifetimes)]
#![feature(let_else)]
#![feature(once_cell)]
#![feature(nll)]
#![feature(associated_type_bounds)]

View file

@ -343,9 +343,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
.unwrap_or_else(|| bug!("indirect_dest has non-pointer type: {:?}", indirect_dest))
.ty;
let (llptr, llextra) = if let OperandValue::Ref(llptr, Some(llextra), _) = self {
(llptr, llextra)
} else {
let OperandValue::Ref(llptr, Some(llextra), _) = self else {
bug!("store_unsized called with a sized value")
};