Remove unnecessary allocations

This commit is contained in:
Jorge Aparicio 2014-10-31 00:03:52 -05:00
parent 423e17b9df
commit fe256f8140
5 changed files with 5 additions and 5 deletions

View file

@ -627,7 +627,7 @@ fn find_rust_src_root(config: &Config) -> Option<Path> {
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
while path.pop() {
if path.join(path_postfix.clone()).is_file() {
if path.join(&path_postfix).is_file() {
return Some(path);
}
}

View file

@ -231,7 +231,7 @@ pub fn build_session_(sopts: config::Options,
if path.is_absolute() {
path.clone()
} else {
os::getcwd().join(path.clone())
os::getcwd().join(&path)
}
);

View file

@ -918,7 +918,7 @@ mod tests {
let prog = pwd_cmd().cwd(&parent_dir).spawn().unwrap();
let output = String::from_utf8(prog.wait_with_output().unwrap().output).unwrap();
let child_dir = Path::new(output.as_slice().trim().into_string());
let child_dir = Path::new(output.as_slice().trim());
let parent_stat = parent_dir.stat().unwrap();
let child_stat = child_dir.stat().unwrap();

View file

@ -41,7 +41,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<Path>> {
if i == "" {
dirs_to_search.push(Path::new("/usr/share/terminfo"));
} else {
dirs_to_search.push(Path::new(i.to_string()));
dirs_to_search.push(Path::new(i));
}
},
// Found nothing in TERMINFO_DIRS, use the default paths:

View file

@ -48,7 +48,7 @@ fn main() {
let child_filestem = Path::new(child_name);
let child_filename = child_filestem.with_extension(my_ext);
let child_path = cwd.join(child_filename.clone());
let child_path = cwd.join(child_filename);
// make a separate directory for the child
drop(fs::mkdir(&cwd, io::USER_RWX).is_ok());