mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Improve namespace parsing comment
This commit is contained in:
parent
7bd48a63f6
commit
a7a00a87fd
1 changed files with 7 additions and 1 deletions
|
@ -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<Self> {
|
||||
[
|
||||
(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()?
|
||||
|
|
Loading…
Reference in a new issue