about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crates/hir-def/src/attr.rs10
-rw-r--r--crates/ide/src/doc_links.rs4
2 files changed, 8 insertions, 6 deletions
diff --git a/crates/hir-def/src/attr.rs b/crates/hir-def/src/attr.rs
index f92de2d42d1..fd444930760 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))
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index 2b788fb6cf9..9ad11b7a653 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -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 {