aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index 7dcf084de..a297ae110 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -71,6 +71,15 @@ impl ast::Attr {
71 _ => None, 71 _ => None,
72 } 72 }
73 } 73 }
74
75 pub fn is_inner_attribute(&self) -> bool {
76 let first_token = self.syntax().first_token();
77 let first_token_kind = first_token.as_ref().map(SyntaxToken::kind);
78 let second_token_kind =
79 first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind);
80 return first_token_kind == Some(SyntaxKind::POUND)
81 && second_token_kind == Some(SyntaxKind::EXCL);
82 }
74} 83}
75 84
76#[derive(Debug, Clone, PartialEq, Eq)] 85#[derive(Debug, Clone, PartialEq, Eq)]