Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/attr.rs')
| -rw-r--r-- | crates/hir-def/src/attr.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/hir-def/src/attr.rs b/crates/hir-def/src/attr.rs index f92de2d42d..fd44493076 100644 --- a/crates/hir-def/src/attr.rs +++ b/crates/hir-def/src/attr.rs @@ -854,11 +854,13 @@ impl<'attr> AttrQuery<'attr> { .filter(move |attr| attr.path.as_ident().map_or(false, |s| s.to_smol_str() == key)) } + /// Find string value for a specific key inside token tree + /// + /// ```ignore + /// #[doc(html_root_url = "url")] + /// ^^^^^^^^^^^^^ key + /// ``` pub fn find_string_value_in_tt(self, key: &'attr str) -> Option<&SmolStr> { - if !self.exists() { - return None; - } - self.tt_values().find_map(|tt| { let name = tt.token_trees.iter() .skip_while(|tt| !matches!(tt, tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident { text, ..} )) if text == key)) |