From cfc671d82482f8e021fa966a01359abba0f53bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Barv=C3=AD=C5=99?= Date: Tue, 4 Apr 2023 17:09:53 +0200 Subject: [PATCH] clippy::match_like_matches_macro (#502) --- src/syntax/ast.rs | 78 +++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs index d718ccf02..780c61647 100644 --- a/src/syntax/ast.rs +++ b/src/syntax/ast.rs @@ -316,49 +316,49 @@ impl AstNode for Expr { impl Expr { /// Can this expression be embedded into markup with a hashtag? pub fn hashtag(&self) -> bool { - match self { - Self::Ident(_) => true, - Self::None(_) => true, - Self::Auto(_) => true, - Self::Bool(_) => true, - Self::Int(_) => true, - Self::Float(_) => true, - Self::Numeric(_) => true, - Self::Str(_) => true, - Self::Code(_) => true, - Self::Content(_) => true, - Self::Array(_) => true, - Self::Dict(_) => true, - Self::Parenthesized(_) => true, - Self::FieldAccess(_) => true, - Self::FuncCall(_) => true, - Self::Let(_) => true, - Self::Set(_) => true, - Self::Show(_) => true, - Self::Conditional(_) => true, - Self::While(_) => true, - Self::For(_) => true, - Self::Import(_) => true, - Self::Include(_) => true, - Self::Break(_) => true, - Self::Continue(_) => true, - Self::Return(_) => true, - _ => false, - } + matches!( + self, + Self::Ident(_) + | Self::None(_) + | Self::Auto(_) + | Self::Bool(_) + | Self::Int(_) + | Self::Float(_) + | Self::Numeric(_) + | Self::Str(_) + | Self::Code(_) + | Self::Content(_) + | Self::Array(_) + | Self::Dict(_) + | Self::Parenthesized(_) + | Self::FieldAccess(_) + | Self::FuncCall(_) + | Self::Let(_) + | Self::Set(_) + | Self::Show(_) + | Self::Conditional(_) + | Self::While(_) + | Self::For(_) + | Self::Import(_) + | Self::Include(_) + | Self::Break(_) + | Self::Continue(_) + | Self::Return(_) + ) } /// Is this a literal? pub fn is_literal(&self) -> bool { - match self { - Self::None(_) => true, - Self::Auto(_) => true, - Self::Bool(_) => true, - Self::Int(_) => true, - Self::Float(_) => true, - Self::Numeric(_) => true, - Self::Str(_) => true, - _ => false, - } + matches!( + self, + Self::None(_) + | Self::Auto(_) + | Self::Bool(_) + | Self::Int(_) + | Self::Float(_) + | Self::Numeric(_) + | Self::Str(_) + ) } }