Update clients of path.rs to use new API.

In most cases this involved removing a ~str allocations or clones
(yay), or coercing a ~str to a slice.  In a few places, I had to bind
an intermediate Path (e.g. path.pop() return values), so that it would
live long enough to support the borrowed &str.

And in a few places, where the code was actively using the property
that the old API returned ~str's, I had to put in to_owned() or
clone(); but in those cases, we're trading an allocation within the
path.rs code for one in the client code, so they neutralize each
other.
This commit is contained in:
Felix S. Klock II
2013-09-04 13:10:22 +02:00
parent 0f3c87e26e
commit 7f834c5c07
9 changed files with 27 additions and 23 deletions

View File

@@ -307,8 +307,9 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
// Try to elide redundant long paths
fn shorten(path: &Path) -> ~str {
let filename = path.filename();
let dir = path.pop().filename();
fmt!("%s/%s", dir.unwrap_or_default(~""), filename.unwrap_or_default(~""))
let p = path.pop();
let dir = p.filename();
fmt!("%s/%s", dir.unwrap_or_default(""), filename.unwrap_or_default(""))
}
test::DynTestName(fmt!("[%s] %s",

View File

@@ -880,7 +880,7 @@ fn _arm_push_aux_shared_library(config: &config, testfile: &Path) {
let dirs = os::list_dir_path(&Path(tstr));
for file in dirs.iter() {
if (file.filetype() == Some(~".so")) {
if (file.filetype() == Some(".so")) {
let copy_result = procsrv::run("", config.adb_path,
[~"push", file.to_str(), config.adb_test_dir.clone()],