diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-19 11:07:13 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-19 12:24:43 -0500 |
| commit | 49684850bedcef007a2949c97872606d1d6dc325 (patch) | |
| tree | 3842f94c466f1466a391cfa344cc448998984f1a /src/libstd/path | |
| parent | 43f2c199e4e87d7ccd15658c52ad8dc5a1d54fb9 (diff) | |
| download | rust-49684850bedcef007a2949c97872606d1d6dc325.tar.gz rust-49684850bedcef007a2949c97872606d1d6dc325.zip | |
remove unnecessary parentheses from range notation
Diffstat (limited to 'src/libstd/path')
| -rw-r--r-- | src/libstd/path/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/path/posix.rs | 10 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 14 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 541f1e77140..f4b99b4c793 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -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[(pos+1)..]) + Some(pos) => Some(&name[pos+1..]) } } } diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index aab64639ab5..422e2cedc48 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -126,7 +126,7 @@ impl GenericPathUnsafe for Path { None => { self.repr = Path::normalize(filename); } - Some(idx) if &self.repr[(idx+1)..] == b".." => { + Some(idx) if &self.repr[idx+1..] == b".." => { let mut v = Vec::with_capacity(self.repr.len() + 1 + filename.len()); v.push_all(self.repr.as_slice()); v.push(SEP_BYTE); @@ -136,7 +136,7 @@ impl GenericPathUnsafe for Path { } Some(idx) => { let mut v = Vec::with_capacity(idx + 1 + filename.len()); - v.push_all(&self.repr[..(idx+1)]); + v.push_all(&self.repr[..idx+1]); v.push_all(filename); // FIXME: this is slow self.repr = Path::normalize(v.as_slice()); @@ -178,7 +178,7 @@ impl GenericPath for Path { None if b".." == self.repr => self.repr.as_slice(), None => dot_static, Some(0) => &self.repr[..1], - Some(idx) if &self.repr[(idx+1)..] == b".." => self.repr.as_slice(), + Some(idx) if &self.repr[idx+1..] == b".." => self.repr.as_slice(), Some(idx) => &self.repr[..idx] } } @@ -188,9 +188,9 @@ impl GenericPath for Path { None if b"." == self.repr || b".." == self.repr => None, None => Some(self.repr.as_slice()), - Some(idx) if &self.repr[(idx+1)..] == b".." => None, + Some(idx) if &self.repr[idx+1..] == b".." => None, Some(0) if self.repr[1..].is_empty() => None, - Some(idx) => Some(&self.repr[(idx+1)..]) + Some(idx) => Some(&self.repr[idx+1..]) } } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 3cff1c67be3..6802b411d1e 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -428,10 +428,10 @@ impl GenericPath for Path { if self.prefix.is_some() { Some(Path::new(match self.prefix { Some(DiskPrefix) if self.is_absolute() => { - &self.repr[..(self.prefix_len()+1)] + &self.repr[..self.prefix_len()+1] } Some(VerbatimDiskPrefix) => { - &self.repr[..(self.prefix_len()+1)] + &self.repr[..self.prefix_len()+1] } _ => &self.repr[..self.prefix_len()] })) @@ -635,7 +635,7 @@ impl Path { Some(_) => { let plen = self.prefix_len(); if repr.len() > plen && repr.as_bytes()[plen] == SEP_BYTE { - &repr[(plen+1)..] + &repr[plen+1..] } else { &repr[plen..] } } None if repr.as_bytes()[0] == SEP_BYTE => &repr[1..], @@ -786,9 +786,9 @@ impl Path { } Some(UNCPrefix(a,b)) => { s.push_str("\\\\"); - s.push_str(&prefix_[2..(a+2)]); + s.push_str(&prefix_[2..a+2]); s.push(SEP); - s.push_str(&prefix_[(3+a)..(3+a+b)]); + s.push_str(&prefix_[3+a..3+a+b]); } Some(_) => s.push_str(prefix_), None => () @@ -813,7 +813,7 @@ impl Path { fn update_sepidx(&mut self) { let s = if self.has_nonsemantic_trailing_slash() { - &self.repr[..(self.repr.len()-1)] + &self.repr[..self.repr.len()-1] } else { &self.repr[] }; let sep_test: fn(char) -> bool = if !prefix_is_verbatim(self.prefix) { is_sep @@ -1029,7 +1029,7 @@ fn parse_prefix<'a>(mut path: &'a str) -> Option<PathPrefix> { None => return None, Some(x) => x }; - path = &path[(idx_a+1)..]; + path = &path[idx_a+1..]; let idx_b = path.find(f).unwrap_or(path.len()); Some((idx_a, idx_b)) } |
