Remove unnecessary allocations
This commit is contained in:
@@ -627,7 +627,7 @@ fn find_rust_src_root(config: &Config) -> Option<Path> {
|
|||||||
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
|
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
|
||||||
|
|
||||||
while path.pop() {
|
while path.pop() {
|
||||||
if path.join(path_postfix.clone()).is_file() {
|
if path.join(&path_postfix).is_file() {
|
||||||
return Some(path);
|
return Some(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ pub fn build_session_(sopts: config::Options,
|
|||||||
if path.is_absolute() {
|
if path.is_absolute() {
|
||||||
path.clone()
|
path.clone()
|
||||||
} else {
|
} else {
|
||||||
os::getcwd().join(path.clone())
|
os::getcwd().join(&path)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -918,7 +918,7 @@ mod tests {
|
|||||||
let prog = pwd_cmd().cwd(&parent_dir).spawn().unwrap();
|
let prog = pwd_cmd().cwd(&parent_dir).spawn().unwrap();
|
||||||
|
|
||||||
let output = String::from_utf8(prog.wait_with_output().unwrap().output).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 parent_stat = parent_dir.stat().unwrap();
|
||||||
let child_stat = child_dir.stat().unwrap();
|
let child_stat = child_dir.stat().unwrap();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<Path>> {
|
|||||||
if i == "" {
|
if i == "" {
|
||||||
dirs_to_search.push(Path::new("/usr/share/terminfo"));
|
dirs_to_search.push(Path::new("/usr/share/terminfo"));
|
||||||
} else {
|
} 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:
|
// Found nothing in TERMINFO_DIRS, use the default paths:
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ fn main() {
|
|||||||
|
|
||||||
let child_filestem = Path::new(child_name);
|
let child_filestem = Path::new(child_name);
|
||||||
let child_filename = child_filestem.with_extension(my_ext);
|
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
|
// make a separate directory for the child
|
||||||
drop(fs::mkdir(&cwd, io::USER_RWX).is_ok());
|
drop(fs::mkdir(&cwd, io::USER_RWX).is_ok());
|
||||||
|
|||||||
Reference in New Issue
Block a user