diff options
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index ae98dbd26..171099661 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs | |||
@@ -125,6 +125,18 @@ pub enum AttrKind { | |||
125 | Outer, | 125 | Outer, |
126 | } | 126 | } |
127 | 127 | ||
128 | impl AttrKind { | ||
129 | /// Returns `true` if the attr_kind is [`Inner`]. | ||
130 | pub fn is_inner(&self) -> bool { | ||
131 | matches!(self, Self::Inner) | ||
132 | } | ||
133 | |||
134 | /// Returns `true` if the attr_kind is [`Outer`]. | ||
135 | pub fn is_outer(&self) -> bool { | ||
136 | matches!(self, Self::Outer) | ||
137 | } | ||
138 | } | ||
139 | |||
128 | impl ast::Attr { | 140 | impl ast::Attr { |
129 | pub fn as_simple_atom(&self) -> Option<SmolStr> { | 141 | pub fn as_simple_atom(&self) -> Option<SmolStr> { |
130 | if self.eq_token().is_some() || self.token_tree().is_some() { | 142 | if self.eq_token().is_some() || self.token_tree().is_some() { |