This commit is contained in:
Lukas Wirth 2021-09-23 15:37:52 +02:00
parent 075fe761f3
commit 42eb4efb5b
7 changed files with 148 additions and 176 deletions

View file

@ -796,6 +796,16 @@ impl ast::TokenTree {
.into_token()
.filter(|it| matches!(it.kind(), T!['}'] | T![')'] | T![']']))
}
pub fn parent_meta(&self) -> Option<ast::Meta> {
self.syntax().parent().and_then(ast::Meta::cast)
}
}
impl ast::Meta {
pub fn parent_attr(&self) -> Option<ast::Attr> {
self.syntax().parent().and_then(ast::Attr::cast)
}
}
impl ast::GenericParamList {