Improve namespace parsing comment
This commit is contained in:
@@ -423,6 +423,12 @@ static MACROS: ([&str; 1], [&str; 1]) = (["macro"], ["!"]);
|
|||||||
|
|
||||||
impl Namespace {
|
impl Namespace {
|
||||||
/// Extract the specified namespace from an intra-doc-link if one exists.
|
/// 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> {
|
fn from_intra_spec(s: &str) -> Option<Self> {
|
||||||
[
|
[
|
||||||
(Namespace::Types, (TYPES.0.iter(), TYPES.1.iter())),
|
(Namespace::Types, (TYPES.0.iter(), TYPES.1.iter())),
|
||||||
@@ -532,7 +538,7 @@ fn try_resolve_intra(
|
|||||||
get_doc_url(db, &krate)?
|
get_doc_url(db, &krate)?
|
||||||
.join(&format!("{}/", krate.display_name(db)?))
|
.join(&format!("{}/", krate.display_name(db)?))
|
||||||
.ok()?
|
.ok()?
|
||||||
.join(&path.segments.iter().map(|name| format!("{}", name)).join("/"))
|
.join(&path.segments.iter().map(|name| name.to_string()).join("/"))
|
||||||
.ok()?
|
.ok()?
|
||||||
.join(&get_symbol_filename(db, &Definition::ModuleDef(def))?)
|
.join(&get_symbol_filename(db, &Definition::ModuleDef(def))?)
|
||||||
.ok()?
|
.ok()?
|
||||||
|
|||||||
Reference in New Issue
Block a user