Skip to content

Commit ddff1b2

Browse files
committed
fix: add docs and remove unnecessary check
1 parent 5f4351f commit ddff1b2

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

crates/hir-def/src/attr.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -854,11 +854,13 @@ impl<'attr> AttrQuery<'attr> {
854854
.filter(move |attr| attr.path.as_ident().map_or(false, |s| s.to_smol_str() == key))
855855
}
856856

857+
/// Find string value for a specific key inside token tree
858+
///
859+
/// ```ignore
860+
/// #[doc(html_root_url = "url")]
861+
/// ^^^^^^^^^^^^^ key
862+
/// ```
857863
pub fn find_string_value_in_tt(self, key: &'attr str) -> Option<&SmolStr> {
858-
if !self.exists() {
859-
return None;
860-
}
861-
862864
self.tt_values().find_map(|tt| {
863865
let name = tt.token_trees.iter()
864866
.skip_while(|tt| !matches!(tt, tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident { text, ..} )) if text == key))

crates/ide/src/doc_links.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ fn map_links<'e>(
374374
// holds the origin link target on start event and the rewritten one on end event
375375
let mut end_link_target: Option<CowStr> = None;
376376
// normally link's type is determined by the type of link tag in the end event,
377-
// however in same cases we want to change the link type.
378-
// For example, Shortcut type doesn't make sense for url links
377+
// however in same cases we want to change the link type, for example,
378+
// `Shortcut` type doesn't make sense for url links
379379
let mut end_link_type: Option<LinkType> = None;
380380

381381
events.map(move |evt| match evt {

0 commit comments

Comments
 (0)