1
Fork 0

Rollup merge of #90642 - matthiaskrgr:clippy_matches, r=cjgillot

use matches!() macro in more places
This commit is contained in:
Matthias Krüger 2021-11-06 23:12:05 +01:00 committed by GitHub
commit 5f0e6ca6a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 49 additions and 86 deletions

View file

@ -212,7 +212,8 @@ impl AssocOp {
/// parentheses while having a high degree of confidence on the correctness of the suggestion.
pub fn can_continue_expr_unambiguously(&self) -> bool {
use AssocOp::*;
match self {
matches!(
self,
BitXor | // `{ 42 } ^ 3`
Assign | // `{ 42 } = { 42 }`
Divide | // `{ 42 } / 42`
@ -225,9 +226,8 @@ impl AssocOp {
As | // `{ 42 } as usize`
// Equal | // `{ 42 } == { 42 }` Accepting these here would regress incorrect
// NotEqual | // `{ 42 } != { 42 } struct literals parser recovery.
Colon => true, // `{ 42 }: usize`
_ => false,
}
Colon, // `{ 42 }: usize`
)
}
}