summaryrefslogtreecommitdiffstats
path: root/src/librustdoc/html/sources.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:53 +0000
commit73e0a5b7696ea019ba35b89f38fc8e7b285d99cb (patch)
tree0d2e175af6f114cb50a675bec0bc76e12e1bceb4 /src/librustdoc/html/sources.rs
parentAdding upstream version 1.75.0+dfsg1. (diff)
downloadrustc-upstream.tar.xz
rustc-upstream.zip
Adding upstream version 1.76.0+dfsg1.upstream/1.76.0+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/librustdoc/html/sources.rs')
-rw-r--r--src/librustdoc/html/sources.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs
index ce620c226..e160ec12f 100644
--- a/src/librustdoc/html/sources.rs
+++ b/src/librustdoc/html/sources.rs
@@ -90,7 +90,9 @@ impl LocalSourcesCollector<'_, '_> {
);
let mut href = href.into_inner().to_string_lossy().into_owned();
- if let Some(c) = href.as_bytes().last() && *c != b'/' {
+ if let Some(c) = href.as_bytes().last()
+ && *c != b'/'
+ {
href.push('/');
}
let mut src_fname = p.file_name().expect("source has no filename").to_os_string();
@@ -212,7 +214,9 @@ impl SourceCollector<'_, '_> {
let root_path = PathBuf::from("../../").join(root_path.into_inner());
let mut root_path = root_path.to_string_lossy();
- if let Some(c) = root_path.as_bytes().last() && *c != b'/' {
+ if let Some(c) = root_path.as_bytes().last()
+ && *c != b'/'
+ {
root_path += "/";
}
let mut cur = self.dst.join(cur.into_inner());