diff options
Diffstat (limited to 'src/libstd/path/mod.rs')
| -rw-r--r-- | src/libstd/path/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 63c81695aff..16552daae36 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -357,7 +357,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { match name.rposition_elem(&dot) { None | Some(0) => name, Some(1) if name == b".." => name, - Some(pos) => name[..pos] + Some(pos) => name.slice_to(pos) } }) } @@ -404,7 +404,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[pos+1..]) + Some(pos) => Some(name.slice_from(pos+1)) } } } @@ -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(name[..idx].to_vec()), + (Some(idx), 0) => Some(name.slice_to(idx).to_vec()), (idx, extlen) => { let idx = match idx { None | Some(0) => name.len(), @@ -489,7 +489,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { let mut v; v = Vec::with_capacity(idx + extlen + 1); - v.push_all(name[..idx]); + v.push_all(name.slice_to(idx)); v.push(dot); v.push_all(extension.container_as_bytes()); Some(v) |
