Apply some review suggestions

This commit is contained in:
Camelid 2020-10-20 13:23:11 -07:00
parent 48060f1a63
commit 243c8e91cf

View File

@ -8,7 +8,7 @@ use crate::html::layout;
use crate::html::render::{SharedContext, BASIC_KEYWORDS}; use crate::html::render::{SharedContext, BASIC_KEYWORDS};
use rustc_hir::def_id::LOCAL_CRATE; use rustc_hir::def_id::LOCAL_CRATE;
use rustc_span::source_map::FileName; use rustc_span::source_map::FileName;
use std::ffi::{OsStr, OsString}; use std::ffi::OsStr;
use std::fs; use std::fs;
use std::path::{Component, Path, PathBuf}; use std::path::{Component, Path, PathBuf};
@ -100,13 +100,13 @@ impl<'a> SourceCollector<'a> {
}); });
self.scx.ensure_dir(&cur)?; self.scx.ensure_dir(&cur)?;
let src_fname = let src_fname = p.file_name().expect("source has no filename").to_os_string();
String::from(p.file_name().expect("source has no filename").to_string_lossy()); let mut fname = src_fname.clone();
let fname = OsString::from(src_fname.clone() + ".html"); fname.push(".html");
cur.push(&fname); cur.push(&fname);
href.push_str(&fname.to_string_lossy()); 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 desc = format!("Source of the Rust file `{}`.", filename);
let page = layout::Page { let page = layout::Page {
title: &title, title: &title,