diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-09-17 12:56:31 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-09-21 22:15:51 -0700 |
| commit | 0169218047dc989acf9ea25e3122b9c659acb6b3 (patch) | |
| tree | 8b1cd720a9e38c745359581e74d216a04e39e5ef /src/libstd/path | |
| parent | 087b9283a0ed8df68f47ab07a25e60bc6a3ca050 (diff) | |
| download | rust-0169218047dc989acf9ea25e3122b9c659acb6b3.tar.gz rust-0169218047dc989acf9ea25e3122b9c659acb6b3.zip | |
Fix fallout from Vec stabilization
Diffstat (limited to 'src/libstd/path')
| -rw-r--r-- | src/libstd/path/mod.rs | 6 | ||||
| -rw-r--r-- | src/libstd/path/posix.rs | 2 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 12 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index d84848545bd..16552daae36 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -76,7 +76,7 @@ use option::{Option, None, Some}; use str; use str::{MaybeOwned, Str, StrSlice}; use string::String; -use slice::Slice; +use slice::{Slice, CloneableVector}; use slice::{ImmutablePartialEqSlice, ImmutableSlice}; use vec::Vec; @@ -480,7 +480,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { let extlen = extension.container_as_bytes().len(); match (name.rposition_elem(&dot), extlen) { (None, 0) | (Some(0), 0) => None, - (Some(idx), 0) => Some(Vec::from_slice(name.slice_to(idx))), + (Some(idx), 0) => Some(name.slice_to(idx).to_vec()), (idx, extlen) => { let idx = match idx { None | Some(0) => name.len(), @@ -798,7 +798,7 @@ pub trait BytesContainer { /// Consumes the receiver and converts it into Vec<u8> #[inline] fn container_into_owned_bytes(self) -> Vec<u8> { - Vec::from_slice(self.container_as_bytes()) + self.container_as_bytes().to_vec() } /// Returns the receiver interpreted as a utf-8 string, if possible #[inline] diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 7d3c7ea71f6..9c4139853c5 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -399,7 +399,7 @@ impl Path { } }; match val { - None => Vec::from_slice(v.as_slice()), + None => v.as_slice().to_vec(), Some(val) => val } } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index e703bfae610..3f598e52806 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -371,7 +371,7 @@ impl GenericPath for Path { #[inline] fn into_vec(self) -> Vec<u8> { - Vec::from_slice(self.repr.as_bytes()) + self.repr.into_bytes() } #[inline] @@ -815,12 +815,14 @@ impl Path { let mut s = String::with_capacity(n); match prefix { Some(DiskPrefix) => { - s.push_char(prefix_.as_bytes()[0].to_ascii().to_uppercase().to_char()); + s.push_char(prefix_.as_bytes()[0].to_ascii() + .to_uppercase().to_char()); s.push_char(':'); } Some(VerbatimDiskPrefix) => { s.push_str(prefix_.slice_to(4)); - s.push_char(prefix_.as_bytes()[4].to_ascii().to_uppercase().to_char()); + s.push_char(prefix_.as_bytes()[4].to_ascii() + .to_uppercase().to_char()); s.push_str(prefix_.slice_from(5)); } Some(UNCPrefix(a,b)) => { @@ -1619,7 +1621,7 @@ mod tests { t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e"); t!(v: b"a\\b\\c", [b"d", b"e"], b"a\\b\\c\\d\\e"); t!(v: b"a\\b\\c", [b"d", b"\\e", b"f"], b"\\e\\f"); - t!(v: b"a\\b\\c", [Vec::from_slice(b"d"), Vec::from_slice(b"e")], + t!(v: b"a\\b\\c", [b"d".to_vec(), b"e".to_vec()], b"a\\b\\c\\d\\e"); } @@ -1759,7 +1761,7 @@ mod tests { t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f"); t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e"); t!(v: b"a\\b\\c", [b"d", b"e"], b"a\\b\\c\\d\\e"); - t!(v: b"a\\b\\c", [Vec::from_slice(b"d"), Vec::from_slice(b"e")], + t!(v: b"a\\b\\c", [b"d".to_vec(), b"e".to_vec()], b"a\\b\\c\\d\\e"); } |
