summaryrefslogtreecommitdiff
path: root/src/syntax/ast.rs
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2021-12-13 15:15:12 +0100
committerMartin Haug <mhaug@live.de>2021-12-13 15:56:14 +0100
commit738ff7e1f573bef678932b313be9969a17af8d22 (patch)
tree3db1a3c16a574390b168c177f627645af2494184 /src/syntax/ast.rs
parent1b67887db0c2f2cd17d60d70c83d56e9e81f4a41 (diff)
Reduce the size of the `FramesEntry` struct and bump edition
Diffstat (limited to 'src/syntax/ast.rs')
-rw-r--r--src/syntax/ast.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs
index 4d698b5e..8df25f59 100644
--- a/src/syntax/ast.rs
+++ b/src/syntax/ast.rs
@@ -27,7 +27,7 @@ macro_rules! node {
($(#[$attr:meta])* $name:ident: $variant:ident) => {
node!{$(#[$attr])* $name: NodeKind::$variant}
};
- ($(#[$attr:meta])* $name:ident: $($variant:pat)|*) => {
+ ($(#[$attr:meta])* $name:ident: $variants:pat) => {
#[derive(Debug, Clone, PartialEq)]
#[repr(transparent)]
$(#[$attr])*
@@ -35,7 +35,7 @@ macro_rules! node {
impl TypedNode for $name {
fn from_red(node: RedRef) -> Option<Self> {
- if matches!(node.kind(), $($variant)|*) {
+ if matches!(node.kind(), $variants) {
Some(Self(node.own()))
} else {
None
@@ -274,15 +274,16 @@ impl TypedNode for Expr {
impl Expr {
/// Whether the expression can be shortened in markup with a hashtag.
pub fn has_short_form(&self) -> bool {
- matches!(self,
+ matches!(
+ self,
Self::Ident(_)
- | Self::Call(_)
- | Self::Let(_)
- | Self::If(_)
- | Self::While(_)
- | Self::For(_)
- | Self::Import(_)
- | Self::Include(_)
+ | Self::Call(_)
+ | Self::Let(_)
+ | Self::If(_)
+ | Self::While(_)
+ | Self::For(_)
+ | Self::Import(_)
+ | Self::Include(_)
)
}
}