diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-07 11:58:31 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-07 17:35:56 -0500 |
| commit | 517f1cc63c1a5df148fdeef56791f66771d3d8e8 (patch) | |
| tree | 0d321b5be3d9610f460561e8dc446a2132bb5422 /src/libstd/path/mod.rs | |
| parent | 6e2bfe4ae8277f0cfe76831b446d50820b4527f5 (diff) | |
| download | rust-517f1cc63c1a5df148fdeef56791f66771d3d8e8.tar.gz rust-517f1cc63c1a5df148fdeef56791f66771d3d8e8.zip | |
use slicing sugar
Diffstat (limited to 'src/libstd/path/mod.rs')
| -rw-r--r-- | src/libstd/path/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 581969e98fb..0d7c213cd96 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -68,7 +68,7 @@ use fmt; use iter::IteratorExt; use option::Option; use option::Option::{None, Some}; -use ops::{FullRange, Index}; +use ops::FullRange; use str; use str::StrExt; use string::{String, CowString}; @@ -352,7 +352,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { match name.rposition_elem(&dot) { None | Some(0) => name, Some(1) if name == b".." => name, - Some(pos) => name.index(&(0..pos)) + Some(pos) => &name[0..pos] } }) } @@ -399,7 +399,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { match name.rposition_elem(&dot) { None | Some(0) => None, Some(1) if name == b".." => None, - Some(pos) => Some(name.index(&((pos+1)..))) + Some(pos) => Some(&name[(pos+1)..]) } } } @@ -475,7 +475,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(name.index(&(0..idx)).to_vec()), + (Some(idx), 0) => Some(name[0..idx].to_vec()), (idx, extlen) => { let idx = match idx { None | Some(0) => name.len(), @@ -484,7 +484,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { let mut v; v = Vec::with_capacity(idx + extlen + 1); - v.push_all(name.index(&(0..idx))); + v.push_all(&name[0..idx]); v.push(dot); v.push_all(extension.container_as_bytes()); Some(v) @@ -877,7 +877,7 @@ impl BytesContainer for String { } #[inline] fn container_as_str(&self) -> Option<&str> { - Some(self.index(&FullRange)) + Some(&self[]) } #[inline] fn is_str(_: Option<&String>) -> bool { true } @@ -893,7 +893,7 @@ impl BytesContainer for [u8] { impl BytesContainer for Vec<u8> { #[inline] fn container_as_bytes(&self) -> &[u8] { - self.index(&FullRange) + &self[] } } |
