aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/attr.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs
index 683c37023..e7019e0c9 100644
--- a/crates/hir_def/src/attr.rs
+++ b/crates/hir_def/src/attr.rs
@@ -162,7 +162,6 @@ impl RawAttrs {
162 let attr = ast::Attr::parse(&format!("#[{}]", tree)).ok()?; 162 let attr = ast::Attr::parse(&format!("#[{}]", tree)).ok()?;
163 // FIXME hygiene 163 // FIXME hygiene
164 let hygiene = Hygiene::new_unhygienic(); 164 let hygiene = Hygiene::new_unhygienic();
165 // FIXME same index is assigned to multiple attributes
166 Attr::from_src(attr, &hygiene).map(|attr| Attr { index, ..attr }) 165 Attr::from_src(attr, &hygiene).map(|attr| Attr { index, ..attr })
167 }); 166 });
168 167
@@ -450,6 +449,13 @@ impl Attr {
450 _ => None, 449 _ => None,
451 } 450 }
452 } 451 }
452
453 pub fn string_value(&self) -> Option<&SmolStr> {
454 match self.input.as_ref()? {
455 AttrInput::Literal(it) => Some(it),
456 _ => None,
457 }
458 }
453} 459}
454 460
455#[derive(Debug, Clone, Copy)] 461#[derive(Debug, Clone, Copy)]