diff options
| author | kennytm <kennytm@gmail.com> | 2018-06-19 04:08:20 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-07-13 09:53:36 +0800 |
| commit | 0d7e9933d3cac85bc1f11dc0fec67fcad77784ca (patch) | |
| tree | 1c0488fda11d56a39db22edb943b7e8e536d0b7d /src/libcore/str | |
| parent | 7db82ccd765cbfe55c3d8a2c434bc6f9b986843d (diff) | |
| download | rust-0d7e9933d3cac85bc1f11dc0fec67fcad77784ca.tar.gz rust-0d7e9933d3cac85bc1f11dc0fec67fcad77784ca.zip | |
Change RangeInclusive to a three-field struct.
Fix #45222.
Diffstat (limited to 'src/libcore/str')
| -rw-r--r-- | src/libcore/str/mod.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 5ae2f6349e5..255e8a07d75 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -2004,31 +2004,31 @@ mod traits { type Output = str; #[inline] fn get(self, slice: &str) -> Option<&Self::Output> { - if self.end == usize::max_value() { None } - else { (self.start..self.end+1).get(slice) } + if *self.end() == usize::max_value() { None } + else { (*self.start()..self.end()+1).get(slice) } } #[inline] fn get_mut(self, slice: &mut str) -> Option<&mut Self::Output> { - if self.end == usize::max_value() { None } - else { (self.start..self.end+1).get_mut(slice) } + if *self.end() == usize::max_value() { None } + else { (*self.start()..self.end()+1).get_mut(slice) } } #[inline] unsafe fn get_unchecked(self, slice: &str) -> &Self::Output { - (self.start..self.end+1).get_unchecked(slice) + (*self.start()..self.end()+1).get_unchecked(slice) } #[inline] unsafe fn get_unchecked_mut(self, slice: &mut str) -> &mut Self::Output { - (self.start..self.end+1).get_unchecked_mut(slice) + (*self.start()..self.end()+1).get_unchecked_mut(slice) } #[inline] fn index(self, slice: &str) -> &Self::Output { - if self.end == usize::max_value() { str_index_overflow_fail(); } - (self.start..self.end+1).index(slice) + if *self.end() == usize::max_value() { str_index_overflow_fail(); } + (*self.start()..self.end()+1).index(slice) } #[inline] fn index_mut(self, slice: &mut str) -> &mut Self::Output { - if self.end == usize::max_value() { str_index_overflow_fail(); } - (self.start..self.end+1).index_mut(slice) + if *self.end() == usize::max_value() { str_index_overflow_fail(); } + (*self.start()..self.end()+1).index_mut(slice) } } |
