aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast/node_ext.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-04-19 15:11:49 +0100
committerAleksey Kladov <[email protected]>2021-04-19 15:11:49 +0100
commit5f89a60f1a0feab1e2e0dd37e642877552675da4 (patch)
tree43fb164ef5ca02ccf8d9e8c3bedaa66d473a019c /crates/syntax/src/ast/node_ext.rs
parente4f7f1e1bd2ca3c1816abf87779ad8893b7bf990 (diff)
fix: false positive about inner attrs in docs
closes #8541
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
-rw-r--r--crates/syntax/src/ast/node_ext.rs12
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
128impl 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
128impl ast::Attr { 140impl 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() {