about summary refs log tree commit diff
path: root/src/librustpkg/package_source.rs
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2013-09-04 13:10:22 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2013-09-04 13:10:32 +0200
commit7f834c5c075afdda7cb493ba75b54dbe950e5b51 (patch)
tree3ec136c0278066dd19afefc456da14402d7cc81c /src/librustpkg/package_source.rs
parent0f3c87e26e2a3583278a07e032ffc476b60cacc7 (diff)
downloadrust-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/package_source.rs')
-rw-r--r--src/librustpkg/package_source.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustpkg/package_source.rs b/src/librustpkg/package_source.rs
index ae2083f1b22..27a22a852a9 100644
--- a/src/librustpkg/package_source.rs
+++ b/src/librustpkg/package_source.rs
@@ -118,7 +118,7 @@ impl PkgSrc {
             return Some(local);
         }
 
-        if (self.id.path.clone()).components().len() < 2 {
+        if self.id.path.components().len() < 2 {
             // If a non-URL, don't bother trying to fetch
             return None;
         }
@@ -156,7 +156,7 @@ impl PkgSrc {
 
     /// True if the given path's stem is self's pkg ID's stem
     fn stem_matches(&self, p: &Path) -> bool {
-        p.filestem().map_default(false, |p| { p == &self.id.short_name })
+        p.filestem().map_default(false, |p| { p == &self.id.short_name.as_slice() })
     }
 
     fn push_crate(cs: &mut ~[Crate], prefix: uint, p: &Path) {
@@ -181,10 +181,10 @@ impl PkgSrc {
         do os::walk_dir(&dir) |pth| {
             let maybe_known_crate_set = match pth.filename() {
                 Some(filename) => match filename {
-                    ~"lib.rs" => Some(&mut self.libs),
-                    ~"main.rs" => Some(&mut self.mains),
-                    ~"test.rs" => Some(&mut self.tests),
-                    ~"bench.rs" => Some(&mut self.benchs),
+                    "lib.rs" => Some(&mut self.libs),
+                    "main.rs" => Some(&mut self.mains),
+                    "test.rs" => Some(&mut self.tests),
+                    "bench.rs" => Some(&mut self.benchs),
                     _ => None
                 },
                 _ => None