about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2020-10-20 13:23:11 -0700
committerCamelid <camelidcamel@gmail.com>2020-10-20 13:23:34 -0700
commit243c8e91cffa9acfbbf8c1a81e5af0d8e6498299 (patch)
tree5eea4ee30edb6fcf66f4ff910f1d170d1c9a57c5
parent48060f1a63aa8b1ae04b34c3597f691d4b5e13db (diff)
downloadrust-243c8e91cffa9acfbbf8c1a81e5af0d8e6498299.tar.gz
rust-243c8e91cffa9acfbbf8c1a81e5af0d8e6498299.zip
Apply some review suggestions
-rw-r--r--src/librustdoc/html/sources.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs
index 8dc30895762..b487b399521 100644
--- a/src/librustdoc/html/sources.rs
+++ b/src/librustdoc/html/sources.rs
@@ -8,7 +8,7 @@ use crate::html::layout;
 use crate::html::render::{SharedContext, BASIC_KEYWORDS};
 use rustc_hir::def_id::LOCAL_CRATE;
 use rustc_span::source_map::FileName;
-use std::ffi::{OsStr, OsString};
+use std::ffi::OsStr;
 use std::fs;
 use std::path::{Component, Path, PathBuf};
 
@@ -100,13 +100,13 @@ impl<'a> SourceCollector<'a> {
         });
         self.scx.ensure_dir(&cur)?;
 
-        let src_fname =
-            String::from(p.file_name().expect("source has no filename").to_string_lossy());
-        let fname = OsString::from(src_fname.clone() + ".html");
+        let src_fname = p.file_name().expect("source has no filename").to_os_string();
+        let mut fname = src_fname.clone();
+        fname.push(".html");
         cur.push(&fname);
         href.push_str(&fname.to_string_lossy());
 
-        let title = format!("{} – source", src_fname,);
+        let title = format!("{} - source", src_fname.to_string_lossy());
         let desc = format!("Source of the Rust file `{}`.", filename);
         let page = layout::Page {
             title: &title,