diff options
| author | fee1-dead <ent3rm4n@gmail.com> | 2023-04-16 19:36:02 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-16 19:36:02 +0800 |
| commit | fba49a7ee2da30a34a1cb05efa249e4267879d7e (patch) | |
| tree | 032e996eba0783cea9763d3002a7bb461cc6a9dd /compiler/rustc_parse/src | |
| parent | 508d661105507f40aebf957aa5bdc59095f8f8f4 (diff) | |
| parent | bcc15bba953dcb749d88950539b5e206a8bd86bb (diff) | |
| download | rust-fba49a7ee2da30a34a1cb05efa249e4267879d7e.tar.gz rust-fba49a7ee2da30a34a1cb05efa249e4267879d7e.zip | |
Rollup merge of #110398 - matthiaskrgr:clippy_match, r=Nilstrieb,fee1-dead
use matches! macro in more places r? `@Nilstrieb`
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/nonterminal.rs | 10 |
2 files changed, 10 insertions, 14 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 6422b8ac1ba..f5fef6ad019 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -2577,14 +2577,12 @@ impl<'a> Parser<'a> { } fn recover_self_param(&mut self) -> bool { - match self - .parse_outer_attributes() - .and_then(|_| self.parse_self_param()) - .map_err(|e| e.cancel()) - { - Ok(Some(_)) => true, - _ => false, - } + matches!( + self.parse_outer_attributes() + .and_then(|_| self.parse_self_param()) + .map_err(|e| e.cancel()), + Ok(Some(_)) + ) } } diff --git a/compiler/rustc_parse/src/parser/nonterminal.rs b/compiler/rustc_parse/src/parser/nonterminal.rs index 7a4d53ed8bb..adb0d372a40 100644 --- a/compiler/rustc_parse/src/parser/nonterminal.rs +++ b/compiler/rustc_parse/src/parser/nonterminal.rs @@ -20,12 +20,10 @@ impl<'a> Parser<'a> { pub fn nonterminal_may_begin_with(kind: NonterminalKind, token: &Token) -> bool { /// Checks whether the non-terminal may contain a single (non-keyword) identifier. fn may_be_ident(nt: &token::Nonterminal) -> bool { - match *nt { - token::NtItem(_) | token::NtBlock(_) | token::NtVis(_) | token::NtLifetime(_) => { - false - } - _ => true, - } + !matches!( + *nt, + token::NtItem(_) | token::NtBlock(_) | token::NtVis(_) | token::NtLifetime(_) + ) } match kind { |
