diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-06-02 07:59:11 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-06-10 01:35:47 +0000 |
| commit | fff822fead6249671cbcb090b24bce58fab38de0 (patch) | |
| tree | 417a72d52d12d147a03535fe7cbe465b3bcdb695 /src/libcore/slice/mod.rs | |
| parent | 283522400b5c13dfdf2b7e608e63a70ee8e3d7af (diff) | |
| download | rust-fff822fead6249671cbcb090b24bce58fab38de0.tar.gz rust-fff822fead6249671cbcb090b24bce58fab38de0.zip | |
Migrate to numeric associated consts
Diffstat (limited to 'src/libcore/slice/mod.rs')
| -rw-r--r-- | src/libcore/slice/mod.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index ff333f77334..8f0b662aa28 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -3043,16 +3043,12 @@ impl<T> SliceIndex<[T]> for ops::RangeInclusive<usize> { #[inline] fn get(self, slice: &[T]) -> Option<&[T]> { - if *self.end() == usize::max_value() { - None - } else { - (*self.start()..self.end() + 1).get(slice) - } + if *self.end() == usize::MAX { None } else { (*self.start()..self.end() + 1).get(slice) } } #[inline] fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]> { - if *self.end() == usize::max_value() { + if *self.end() == usize::MAX { None } else { (*self.start()..self.end() + 1).get_mut(slice) @@ -3071,7 +3067,7 @@ impl<T> SliceIndex<[T]> for ops::RangeInclusive<usize> { #[inline] fn index(self, slice: &[T]) -> &[T] { - if *self.end() == usize::max_value() { + if *self.end() == usize::MAX { slice_index_overflow_fail(); } (*self.start()..self.end() + 1).index(slice) @@ -3079,7 +3075,7 @@ impl<T> SliceIndex<[T]> for ops::RangeInclusive<usize> { #[inline] fn index_mut(self, slice: &mut [T]) -> &mut [T] { - if *self.end() == usize::max_value() { + if *self.end() == usize::MAX { slice_index_overflow_fail(); } (*self.start()..self.end() + 1).index_mut(slice) |
