]> git.lizzy.rs Git - rust.git/commitdiff
Don't construct `PathBuf` ownership if we don't need it.
authorCorey Farwell <coreyf@rwell.org>
Sat, 8 Oct 2016 20:29:10 +0000 (16:29 -0400)
committerCorey Farwell <coreyf@rwell.org>
Sun, 9 Oct 2016 01:33:28 +0000 (21:33 -0400)
src/librustdoc/externalfiles.rs

index 2ecb071fcc2a4228694c8eeb47c693b19b246fd9..8b71c133ed48b3b2eba3da5426ae6fa8a473e853 100644 (file)
@@ -11,7 +11,7 @@
 use std::fs::File;
 use std::io::prelude::*;
 use std::io;
-use std::path::{PathBuf, Path};
+use std::path::Path;
 use std::str;
 
 #[derive(Clone)]
@@ -47,8 +47,8 @@ pub fn load_string(input: &Path) -> io::Result<Option<String>> {
 macro_rules! load_or_return {
     ($input: expr, $cant_read: expr, $not_utf8: expr) => {
         {
-            let input = PathBuf::from(&$input[..]);
-            match ::externalfiles::load_string(&input) {
+            let input = Path::new(&$input[..]);
+            match ::externalfiles::load_string(input) {
                 Err(e) => {
                     let _ = writeln!(&mut io::stderr(),
                                      "error reading `{}`: {}", input.display(), e);