Skip to content

Commit fe256f8

Browse files
author
Jorge Aparicio
committed
Remove unnecessary allocations
1 parent 423e17b commit fe256f8

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/compiletest/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ fn find_rust_src_root(config: &Config) -> Option<Path> {
627627
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
628628

629629
while path.pop() {
630-
if path.join(path_postfix.clone()).is_file() {
630+
if path.join(&path_postfix).is_file() {
631631
return Some(path);
632632
}
633633
}

src/librustc/driver/session.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub fn build_session_(sopts: config::Options,
231231
if path.is_absolute() {
232232
path.clone()
233233
} else {
234-
os::getcwd().join(path.clone())
234+
os::getcwd().join(&path)
235235
}
236236
);
237237

src/libstd/io/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ mod tests {
918918
let prog = pwd_cmd().cwd(&parent_dir).spawn().unwrap();
919919

920920
let output = String::from_utf8(prog.wait_with_output().unwrap().output).unwrap();
921-
let child_dir = Path::new(output.as_slice().trim().into_string());
921+
let child_dir = Path::new(output.as_slice().trim());
922922

923923
let parent_stat = parent_dir.stat().unwrap();
924924
let child_stat = child_dir.stat().unwrap();

src/libterm/terminfo/searcher.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<Path>> {
4141
if i == "" {
4242
dirs_to_search.push(Path::new("/usr/share/terminfo"));
4343
} else {
44-
dirs_to_search.push(Path::new(i.to_string()));
44+
dirs_to_search.push(Path::new(i));
4545
}
4646
},
4747
// Found nothing in TERMINFO_DIRS, use the default paths:

src/test/run-pass/process-spawn-with-unicode-params.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn main() {
4848

4949
let child_filestem = Path::new(child_name);
5050
let child_filename = child_filestem.with_extension(my_ext);
51-
let child_path = cwd.join(child_filename.clone());
51+
let child_path = cwd.join(child_filename);
5252

5353
// make a separate directory for the child
5454
drop(fs::mkdir(&cwd, io::USER_RWX).is_ok());

0 commit comments

Comments
 (0)