From 5f89a60f1a0feab1e2e0dd37e642877552675da4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 19 Apr 2021 17:11:49 +0300 Subject: fix: false positive about inner attrs in docs closes #8541 --- crates/syntax/src/ast/node_ext.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/syntax/src/ast') 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 { Outer, } +impl AttrKind { + /// Returns `true` if the attr_kind is [`Inner`]. + pub fn is_inner(&self) -> bool { + matches!(self, Self::Inner) + } + + /// Returns `true` if the attr_kind is [`Outer`]. + pub fn is_outer(&self) -> bool { + matches!(self, Self::Outer) + } +} + impl ast::Attr { pub fn as_simple_atom(&self) -> Option { if self.eq_token().is_some() || self.token_tree().is_some() { -- cgit v1.2.3