diff options
| author | est31 <MTest31@outlook.com> | 2022-02-19 00:48:49 +0100 | 
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2022-02-19 17:27:43 +0100 | 
| commit | 2ef8af66196f7cc270a0532ea989f2fc6bc6885d (patch) | |
| tree | e023e65e895d79575848f47b3d00129f9c5a9f0f /compiler/rustc_passes/src/check_attr.rs | |
| parent | b8c56fa8c30821129b0960180f528d4a1a4f9316 (diff) | |
| download | rust-2ef8af66196f7cc270a0532ea989f2fc6bc6885d.tar.gz rust-2ef8af66196f7cc270a0532ea989f2fc6bc6885d.zip | |
Adopt let else in more places
Diffstat (limited to 'compiler/rustc_passes/src/check_attr.rs')
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 21 | 
1 files changed, 9 insertions, 12 deletions
| diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 479a08e43c0..3d69e8ba4e4 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -1318,9 +1318,8 @@ impl CheckAttrVisitor<'_> { return false; } - let list = match attr.meta_item_list() { - None => return false, - Some(it) => it, + let Some(list) = attr.meta_item_list() else { + return false; }; if matches!(&list[..], &[NestedMetaItem::Literal(Lit { kind: LitKind::Int(..), .. })]) { @@ -1352,18 +1351,16 @@ impl CheckAttrVisitor<'_> { return false; } - let list = match attr.meta_item_list() { + let Some(list) = attr.meta_item_list() else { // The attribute form is validated on AST. - None => return false, - Some(it) => it, + return false; }; - let (decl, generics) = match item { - Some(ItemLike::Item(Item { - kind: ItemKind::Fn(FnSig { decl, .. }, generics, _), - .. - })) => (decl, generics), - _ => bug!("should be a function item"), + let Some(ItemLike::Item(Item { + kind: ItemKind::Fn(FnSig { decl, .. }, generics, _), + .. + })) = item else { + bug!("should be a function item"); }; for param in generics.params { | 
