From ddff1b22f957e98aa98acff87ce86c04c72db308 Mon Sep 17 00:00:00 2001 From: rainy-me Date: Thu, 5 May 2022 13:41:33 +0900 Subject: [PATCH] fix: add docs and remove unnecessary check --- crates/hir-def/src/attr.rs | 10 ++++++---- crates/ide/src/doc_links.rs | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/hir-def/src/attr.rs b/crates/hir-def/src/attr.rs index f92de2d42d..fd44493076 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 2b788fb6cf..9ad11b7a65 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 = 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 = None; events.map(move |evt| match evt {