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

@@ -164,9 +164,7 @@ impl<'tcx> OnUnimplementedDirective {
) -> Result<Option<Self>, ErrorReported> {
let attrs = tcx.get_attrs(impl_def_id);
let attr = if let Some(item) = tcx.sess.find_by_name(&attrs, sym::rustc_on_unimplemented) {
item
} else {
let Some(attr) = tcx.sess.find_by_name(&attrs, sym::rustc_on_unimplemented) else {
return Ok(None);
};