diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-10 13:09:51 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-10 23:02:54 +1000 |
| commit | 0cfc08d81e7cc664330ce9d38a874c14a4ae51bf (patch) | |
| tree | ad575636aa13556e1f6cb605b77c296e87596499 /src/libstd/path.rs | |
| parent | 76fc9be5a1634c8b7ebf766f51ad594d9012fe9c (diff) | |
| download | rust-0cfc08d81e7cc664330ce9d38a874c14a4ae51bf.tar.gz rust-0cfc08d81e7cc664330ce9d38a874c14a4ae51bf.zip | |
std: convert character-based str::find_* to methods. Add .slice_{to,from} methods.
Diffstat (limited to 'src/libstd/path.rs')
| -rw-r--r-- | src/libstd/path.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index eb78120c6be..4df07830b23 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -479,8 +479,8 @@ impl GenericPath for PosixPath { match self.filename() { None => None, Some(ref f) => { - match str::rfind_char(*f, '.') { - Some(p) => Some(f.slice(0, p).to_owned()), + match f.rfind('.') { + Some(p) => Some(f.slice_to(p).to_owned()), None => Some(copy *f), } } @@ -491,8 +491,8 @@ impl GenericPath for PosixPath { match self.filename() { None => None, Some(ref f) => { - match str::rfind_char(*f, '.') { - Some(p) if p < f.len() => Some(f.slice(p, f.len()).to_owned()), + match f.rfind('.') { + Some(p) if p < f.len() => Some(f.slice_from(p).to_owned()), _ => None, } } @@ -693,8 +693,8 @@ impl GenericPath for WindowsPath { match self.filename() { None => None, Some(ref f) => { - match str::rfind_char(*f, '.') { - Some(p) => Some(f.slice(0, p).to_owned()), + match f.rfind('.') { + Some(p) => Some(f.slice_to(p).to_owned()), None => Some(copy *f), } } @@ -705,8 +705,8 @@ impl GenericPath for WindowsPath { match self.filename() { None => None, Some(ref f) => { - match str::rfind_char(*f, '.') { - Some(p) if p < f.len() => Some(f.slice(p, f.len()).to_owned()), + match f.rfind('.') { + Some(p) if p < f.len() => Some(f.slice_from(p).to_owned()), _ => None, } } |
