Add generic conversion traits
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
This commit is contained in:
parent
b0aad7dd4f
commit
8389253df0
69 changed files with 666 additions and 196 deletions
|
@ -300,7 +300,7 @@ pub fn run(mut krate: clean::Crate,
|
|||
passes: HashSet<String>) -> io::Result<()> {
|
||||
let src_root = match krate.src.parent() {
|
||||
Some(p) => p.to_path_buf(),
|
||||
None => PathBuf::new(""),
|
||||
None => PathBuf::new(),
|
||||
};
|
||||
let mut cx = Context {
|
||||
dst: dst,
|
||||
|
@ -784,7 +784,7 @@ impl<'a> DocFolder for SourceCollector<'a> {
|
|||
impl<'a> SourceCollector<'a> {
|
||||
/// Renders the given filename into its corresponding HTML source file.
|
||||
fn emit_source(&mut self, filename: &str) -> io::Result<()> {
|
||||
let p = PathBuf::new(filename);
|
||||
let p = PathBuf::from(filename);
|
||||
|
||||
// If we couldn't open this file, then just returns because it
|
||||
// probably means that it's some standard library macro thing and we
|
||||
|
@ -819,7 +819,7 @@ impl<'a> SourceCollector<'a> {
|
|||
let mut fname = p.file_name().expect("source has no filename")
|
||||
.to_os_string();
|
||||
fname.push(".html");
|
||||
cur.push(&fname);
|
||||
cur.push(&fname[..]);
|
||||
let mut w = BufWriter::new(try!(File::create(&cur)));
|
||||
|
||||
let title = format!("{} -- source", cur.file_name().unwrap()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue