Use usize::MAX as assoc const in liballoc
This commit is contained in:
parent
09b5d666a0
commit
e4fc04b6df
@ -608,7 +608,7 @@ fn drop(&mut self) {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
|
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)
|
Err(CapacityOverflow)
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -475,7 +475,7 @@ fn check<'a, L, R>(lhs: L, rhs: R)
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_range_inclusive_max_value() {
|
fn test_range_inclusive_max_value() {
|
||||||
let max = std::usize::MAX;
|
let max = usize::MAX;
|
||||||
let map: BTreeMap<_, _> = vec![(max, 0)].into_iter().collect();
|
let map: BTreeMap<_, _> = vec![(max, 0)].into_iter().collect();
|
||||||
|
|
||||||
assert_eq!(map.range(max..=max).collect::<Vec<_>>(), &[(&max, &0)]);
|
assert_eq!(map.range(max..=max).collect::<Vec<_>>(), &[(&max, &0)]);
|
||||||
|
Loading…
Reference in New Issue
Block a user