Skip to content

Commit a7a00a8

Browse files
committed
Improve namespace parsing comment
1 parent 7bd48a6 commit a7a00a8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/ra_ide/src/hover.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ static MACROS: ([&str; 1], [&str; 1]) = (["macro"], ["!"]);
423423

424424
impl Namespace {
425425
/// Extract the specified namespace from an intra-doc-link if one exists.
426+
///
427+
/// # Examples
428+
///
429+
/// * `struct MyStruct` -> `Namespace::Types`
430+
/// * `panic!` -> `Namespace::Macros`
431+
/// * `fn@from_intra_spec` -> `Namespace::Values`
426432
fn from_intra_spec(s: &str) -> Option<Self> {
427433
[
428434
(Namespace::Types, (TYPES.0.iter(), TYPES.1.iter())),
@@ -532,7 +538,7 @@ fn try_resolve_intra(
532538
get_doc_url(db, &krate)?
533539
.join(&format!("{}/", krate.display_name(db)?))
534540
.ok()?
535-
.join(&path.segments.iter().map(|name| format!("{}", name)).join("/"))
541+
.join(&path.segments.iter().map(|name| name.to_string()).join("/"))
536542
.ok()?
537543
.join(&get_symbol_filename(db, &Definition::ModuleDef(def))?)
538544
.ok()?

0 commit comments

Comments
 (0)