Use usize::MAX as assoc const in liballoc

This commit is contained in:
Linus Färnstrand 2020-04-06 23:07:38 +02:00
parent 09b5d666a0
commit e4fc04b6df
2 changed files with 2 additions and 2 deletions

View File

@ -608,7 +608,7 @@ fn drop(&mut self) {
#[inline]
fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
if mem::size_of::<usize>() < 8 && alloc_size > core::isize::MAX as usize {
if mem::size_of::<usize>() < 8 && alloc_size > isize::MAX as usize {
Err(CapacityOverflow)
} else {
Ok(())

View File

@ -475,7 +475,7 @@ fn check<'a, L, R>(lhs: L, rhs: R)
#[test]
fn test_range_inclusive_max_value() {
let max = std::usize::MAX;
let max = usize::MAX;
let map: BTreeMap<_, _> = vec![(max, 0)].into_iter().collect();
assert_eq!(map.range(max..=max).collect::<Vec<_>>(), &[(&max, &0)]);