From a7a00a87fd20a8b697a603d68e60e6ffbc59aac8 Mon Sep 17 00:00:00 2001 From: Zac Pullar-Strecker Date: Sat, 1 Aug 2020 12:39:07 +1200 Subject: Improve namespace parsing comment --- crates/ra_ide/src/hover.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide/src/hover.rs') diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index f6854a18d..784a1e77c 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -423,6 +423,12 @@ static MACROS: ([&str; 1], [&str; 1]) = (["macro"], ["!"]); impl Namespace { /// Extract the specified namespace from an intra-doc-link if one exists. + /// + /// # Examples + /// + /// * `struct MyStruct` -> `Namespace::Types` + /// * `panic!` -> `Namespace::Macros` + /// * `fn@from_intra_spec` -> `Namespace::Values` fn from_intra_spec(s: &str) -> Option { [ (Namespace::Types, (TYPES.0.iter(), TYPES.1.iter())), @@ -532,7 +538,7 @@ fn try_resolve_intra( get_doc_url(db, &krate)? .join(&format!("{}/", krate.display_name(db)?)) .ok()? - .join(&path.segments.iter().map(|name| format!("{}", name)).join("/")) + .join(&path.segments.iter().map(|name| name.to_string()).join("/")) .ok()? .join(&get_symbol_filename(db, &Definition::ModuleDef(def))?) .ok()? -- cgit v1.2.3