mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
clippy::match_like_matches_macro (#502)
This commit is contained in:
parent
8aca3ca3c1
commit
cfc671d824
@ -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(_)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user