a lot of clippy::style fixes

This commit is contained in:
Matthias Krüger 2021-03-21 15:33:18 +01:00
parent ae7e55c1dd
commit 202b51bc7b
19 changed files with 52 additions and 69 deletions

View file

@ -58,10 +58,7 @@ impl From<ast::MacroDef> for Macro {
impl AstNode for Macro {
fn can_cast(kind: SyntaxKind) -> bool {
match kind {
SyntaxKind::MACRO_RULES | SyntaxKind::MACRO_DEF => true,
_ => false,
}
matches!(kind, SyntaxKind::MACRO_RULES | SyntaxKind::MACRO_DEF)
}
fn cast(syntax: SyntaxNode) -> Option<Self> {
let res = match syntax.kind() {
@ -462,10 +459,8 @@ impl ast::FieldExpr {
pub fn field_access(&self) -> Option<FieldKind> {
if let Some(nr) = self.name_ref() {
Some(FieldKind::Name(nr))
} else if let Some(tok) = self.index_token() {
Some(FieldKind::Index(tok))
} else {
None
self.index_token().map(FieldKind::Index)
}
}
}
@ -482,16 +477,10 @@ impl ast::SlicePat {
let prefix = args
.peeking_take_while(|p| match p {
ast::Pat::RestPat(_) => false,
ast::Pat::IdentPat(bp) => match bp.pat() {
Some(ast::Pat::RestPat(_)) => false,
_ => true,
},
ast::Pat::IdentPat(bp) => !matches!(bp.pat(), Some(ast::Pat::RestPat(_))),
ast::Pat::RefPat(rp) => match rp.pat() {
Some(ast::Pat::RestPat(_)) => false,
Some(ast::Pat::IdentPat(bp)) => match bp.pat() {
Some(ast::Pat::RestPat(_)) => false,
_ => true,
},
Some(ast::Pat::IdentPat(bp)) => !matches!(bp.pat(), Some(ast::Pat::RestPat(_))),
_ => true,
},
_ => true,