From a6263694ffbe00b728080280c9ad00be6ee830cf Mon Sep 17 00:00:00 2001 From: Gareth Smith Date: Sun, 21 Jul 2013 18:33:29 +0100 Subject: [PATCH] Remove what appears to be redundant indirection from os::list_dir_path. --- src/compiletest/compiletest.rs | 10 +++++----- src/librustc/metadata/filesearch.rs | 2 +- src/librustpkg/tests.rs | 4 ++-- src/libstd/os.rs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 0ef8aa714b553..956e8aaad2341 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -242,13 +242,13 @@ pub fn make_tests(config: &config) -> ~[test::TestDescAndFn] { let mut tests = ~[]; let dirs = os::list_dir_path(&config.src_base); for dirs.iter().advance |file| { - let file = (*file).clone(); + let file = file.clone(); debug!("inspecting file %s", file.to_str()); - if is_test(config, file) { - let t = do make_test(config, file) { + if is_test(config, &file) { + let t = do make_test(config, &file) { match config.mode { - mode_codegen => make_metrics_test_closure(config, file), - _ => make_test_closure(config, file) + mode_codegen => make_metrics_test_closure(config, &file), + _ => make_test_closure(config, &file) } }; tests.push(t) diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 112965127a25b..de4eb5c395321 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -94,7 +94,7 @@ pub fn search(filesearch: @FileSearch, pick: pick) -> Option { let r = os::list_dir_path(lib_search_path); for r.iter().advance |path| { debug!("testing %s", path.to_str()); - let maybe_picked = pick(*path); + let maybe_picked = pick(path); if maybe_picked.is_some() { debug!("picked %s", path.to_str()); rslt = maybe_picked; diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs index 7953d4545a845..49db08734ea2c 100644 --- a/src/librustpkg/tests.rs +++ b/src/librustpkg/tests.rs @@ -393,9 +393,9 @@ fn frob_source_file(workspace: &Path, pkgid: &PkgId) { } match maybe_p { Some(p) => { - let w = io::file_writer(*p, &[io::Append]); + let w = io::file_writer(p, &[io::Append]); match w { - Err(s) => { let _ = cond.raise(((**p).clone(), fmt!("Bad path: %s", s))); } + Err(s) => { let _ = cond.raise((p.clone(), fmt!("Bad path: %s", s))); } Ok(w) => w.write_line("") } } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 3b37fb077d66d..b07d133f703d7 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -788,8 +788,8 @@ pub fn list_dir(p: &Path) -> ~[~str] { * * This version prepends each entry with the directory. */ -pub fn list_dir_path(p: &Path) -> ~[~Path] { - list_dir(p).map(|f| ~p.push(*f)) +pub fn list_dir_path(p: &Path) -> ~[Path] { + list_dir(p).map(|f| p.push(*f)) } /// Removes a directory at the specified path, after removing