diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2013-09-04 13:10:22 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2013-09-04 13:10:32 +0200 |
| commit | 7f834c5c075afdda7cb493ba75b54dbe950e5b51 (patch) | |
| tree | 3ec136c0278066dd19afefc456da14402d7cc81c /src/librustpkg/path_util.rs | |
| parent | 0f3c87e26e2a3583278a07e032ffc476b60cacc7 (diff) | |
| download | rust-7f834c5c075afdda7cb493ba75b54dbe950e5b51.tar.gz rust-7f834c5c075afdda7cb493ba75b54dbe950e5b51.zip | |
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.
Diffstat (limited to 'src/librustpkg/path_util.rs')
| -rw-r--r-- | src/librustpkg/path_util.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustpkg/path_util.rs b/src/librustpkg/path_util.rs index af70a79f93d..cbe6c8f65c4 100644 --- a/src/librustpkg/path_util.rs +++ b/src/librustpkg/path_util.rs @@ -234,14 +234,14 @@ pub fn library_in_workspace(path: &Path, short_name: &str, where: Target, Some(j) => { debug!("Maybe %s equals %s", f_name.slice(0, j), lib_prefix); if f_name.slice(0, j) == lib_prefix { - result_filename = Some(p_path); + result_filename = Some(p_path.clone()); } break; } None => break } } - _ => { f_name = f_name.slice(0, i).to_owned(); } + _ => { f_name = f_name.slice(0, i); } } } None => break |
