about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorAndy Wang <cbeuw.andy@gmail.com>2021-04-19 23:27:02 +0100
committerAndy Wang <cbeuw.andy@gmail.com>2021-05-05 15:31:28 +0100
commit5417b45c2676dcd396f007bd89ed0cd55d085768 (patch)
tree25a9819f523855d604aa373edb93c850f817532f /src/librustdoc/html/render
parentfb4f6439f62d4b940bdfab3f78771d76eacab379 (diff)
downloadrust-5417b45c2676dcd396f007bd89ed0cd55d085768.tar.gz
rust-5417b45c2676dcd396f007bd89ed0cd55d085768.zip
Use local and remapped paths where appropriate
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/context.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index 95f3a32e41f..288c7785bc9 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -376,17 +376,10 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
         } = options;
 
         let src_root = match krate.src {
-            FileName::Real(ref p) => {
-                if let Some(local_path) = p.local_path() {
-                    match local_path.parent() {
-                        Some(p) => p.to_path_buf(),
-                        None => PathBuf::new(),
-                    }
-                } else {
-                    // Somehow we got the filename from the metadata of another crate, should never happen
-                    PathBuf::new()
-                }
-            }
+            FileName::Real(ref p) => match p.local_path_if_available().parent() {
+                Some(p) => p.to_path_buf(),
+                None => PathBuf::new(),
+            },
             _ => PathBuf::new(),
         };
         // If user passed in `--playground-url` arg, we fill in crate name here