mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
fix: add docs and remove unnecessary check
This commit is contained in:
parent
5f4351fbb6
commit
ddff1b22f9
2 changed files with 8 additions and 6 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue