mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-14 12:29:30 +00:00
Parse extended_key_value_attributes
This commit is contained in:
parent
816bc73895
commit
4771a56791
7 changed files with 32 additions and 41 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue