mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +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))
|
.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> {
|
pub fn find_string_value_in_tt(self, key: &'attr str) -> Option<&SmolStr> {
|
||||||
if !self.exists() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.tt_values().find_map(|tt| {
|
self.tt_values().find_map(|tt| {
|
||||||
let name = tt.token_trees.iter()
|
let name = tt.token_trees.iter()
|
||||||
.skip_while(|tt| !matches!(tt, tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident { text, ..} )) if text == key))
|
.skip_while(|tt| !matches!(tt, tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident { text, ..} )) if text == key))
|
||||||
|
|
|
@ -374,8 +374,8 @@ fn map_links<'e>(
|
||||||
// holds the origin link target on start event and the rewritten one on end event
|
// holds the origin link target on start event and the rewritten one on end event
|
||||||
let mut end_link_target: Option<CowStr> = None;
|
let mut end_link_target: Option<CowStr> = None;
|
||||||
// normally link's type is determined by the type of link tag in the end event,
|
// normally link's type is determined by the type of link tag in the end event,
|
||||||
// however in same cases we want to change the link type.
|
// however in same cases we want to change the link type, for example,
|
||||||
// For example, Shortcut type doesn't make sense for url links
|
// `Shortcut` type doesn't make sense for url links
|
||||||
let mut end_link_type: Option<LinkType> = None;
|
let mut end_link_type: Option<LinkType> = None;
|
||||||
|
|
||||||
events.map(move |evt| match evt {
|
events.map(move |evt| match evt {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue