mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +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))
|
||||
|
|
|
@ -374,8 +374,8 @@ fn map_links<'e>(
|
|||
// holds the origin link target on start event and the rewritten one on end event
|
||||
let mut end_link_target: Option<CowStr> = None;
|
||||
// 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.
|
||||
// For example, Shortcut type doesn't make sense for url links
|
||||
// however in same cases we want to change the link type, for example,
|
||||
// `Shortcut` type doesn't make sense for url links
|
||||
let mut end_link_type: Option<LinkType> = None;
|
||||
|
||||
events.map(move |evt| match evt {
|
||||
|
|
Loading…
Reference in a new issue