Parse extended_key_value_attributes

This commit is contained in:
Lukas Wirth 2021-03-18 22:25:10 +01:00
parent 816bc73895
commit 4771a56791
7 changed files with 32 additions and 41 deletions

View file

@ -109,16 +109,6 @@ impl ast::Attr {
Some((self.simple_name()?, tt))
}
pub fn as_simple_key_value(&self) -> Option<(SmolStr, SmolStr)> {
let lit = self.literal()?;
let key = self.simple_name()?;
let value_token = lit.syntax().first_token()?;
let value: SmolStr = ast::String::cast(value_token)?.value()?.into();
Some((key, value))
}
pub fn simple_name(&self) -> Option<SmolStr> {
let path = self.path()?;
match (path.segment(), path.qualifier()) {