clippy::match_like_matches_macro (#502)

This commit is contained in:
Marek Barvíř 2023-04-04 17:09:53 +02:00 committed by GitHub
parent 8aca3ca3c1
commit cfc671d824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -316,49 +316,49 @@ impl AstNode for Expr {
impl Expr { impl Expr {
/// Can this expression be embedded into markup with a hashtag? /// Can this expression be embedded into markup with a hashtag?
pub fn hashtag(&self) -> bool { pub fn hashtag(&self) -> bool {
match self { matches!(
Self::Ident(_) => true, self,
Self::None(_) => true, Self::Ident(_)
Self::Auto(_) => true, | Self::None(_)
Self::Bool(_) => true, | Self::Auto(_)
Self::Int(_) => true, | Self::Bool(_)
Self::Float(_) => true, | Self::Int(_)
Self::Numeric(_) => true, | Self::Float(_)
Self::Str(_) => true, | Self::Numeric(_)
Self::Code(_) => true, | Self::Str(_)
Self::Content(_) => true, | Self::Code(_)
Self::Array(_) => true, | Self::Content(_)
Self::Dict(_) => true, | Self::Array(_)
Self::Parenthesized(_) => true, | Self::Dict(_)
Self::FieldAccess(_) => true, | Self::Parenthesized(_)
Self::FuncCall(_) => true, | Self::FieldAccess(_)
Self::Let(_) => true, | Self::FuncCall(_)
Self::Set(_) => true, | Self::Let(_)
Self::Show(_) => true, | Self::Set(_)
Self::Conditional(_) => true, | Self::Show(_)
Self::While(_) => true, | Self::Conditional(_)
Self::For(_) => true, | Self::While(_)
Self::Import(_) => true, | Self::For(_)
Self::Include(_) => true, | Self::Import(_)
Self::Break(_) => true, | Self::Include(_)
Self::Continue(_) => true, | Self::Break(_)
Self::Return(_) => true, | Self::Continue(_)
_ => false, | Self::Return(_)
} )
} }
/// Is this a literal? /// Is this a literal?
pub fn is_literal(&self) -> bool { pub fn is_literal(&self) -> bool {
match self { matches!(
Self::None(_) => true, self,
Self::Auto(_) => true, Self::None(_)
Self::Bool(_) => true, | Self::Auto(_)
Self::Int(_) => true, | Self::Bool(_)
Self::Float(_) => true, | Self::Int(_)
Self::Numeric(_) => true, | Self::Float(_)
Self::Str(_) => true, | Self::Numeric(_)
_ => false, | Self::Str(_)
} )
} }
} }