fix: false positive about inner attrs in docs

closes #8541
This commit is contained in:
Aleksey Kladov 2021-04-19 17:11:49 +03:00
parent e4f7f1e1bd
commit 5f89a60f1a
6 changed files with 238 additions and 182 deletions

View file

@ -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<SmolStr> {
if self.eq_token().is_some() || self.token_tree().is_some() {