diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2020-07-17 11:04:31 -0700 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2020-07-17 11:04:36 -0700 |
| commit | fe98de2a8e3941bb33d1149c3717d8ea0744e39c (patch) | |
| tree | 162667968fbfc07ebeedf203f0d09a3b64915a88 /src | |
| parent | 3014f23ddd437d2ba9947383c4565d09c1eb39f2 (diff) | |
| download | rust-fe98de2a8e3941bb33d1149c3717d8ea0744e39c.tar.gz rust-fe98de2a8e3941bb33d1149c3717d8ea0744e39c.zip | |
intra-doc links: Resolve modules in type namespace
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/passes/collect_intra_doc_links.rs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index b1db1328392..e187b9251f7 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -584,25 +584,18 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { let (res, fragment) = { let mut kind = None; let mut disambiguator = None; - path_str = if let Some(prefix) = ["struct@", "enum@", "type@", "trait@", "union@"] - .iter() - .find(|p| link.starts_with(**p)) + path_str = if let Some(prefix) = + ["struct@", "enum@", "type@", "trait@", "union@", "module@", "mod@"] + .iter() + .find(|p| link.starts_with(**p)) { kind = Some(TypeNS); disambiguator = Some(&prefix[..prefix.len() - 1]); link.trim_start_matches(prefix) - } else if let Some(prefix) = [ - "const@", - "static@", - "value@", - "function@", - "mod@", - "fn@", - "module@", - "method@", - ] - .iter() - .find(|p| link.starts_with(**p)) + } else if let Some(prefix) = + ["const@", "static@", "value@", "function@", "fn@", "method@"] + .iter() + .find(|p| link.starts_with(**p)) { kind = Some(ValueNS); disambiguator = Some(&prefix[..prefix.len() - 1]); |
