Skip to content

Commit 7bb3a45

Browse files
committed
Remove usage of module level MAX/MIN constants
1 parent 5f687fb commit 7bb3a45

File tree

142 files changed

+210
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+210
-293
lines changed

src/etc/test-float-parse/u64-pow2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod _common;
22

33
use _common::validate;
4-
use std::u64;
54

65
fn main() {
76
for exp in 19..64 {

src/liballoc/alloc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use core::intrinsics::{min_align_of_val, size_of_val};
66
use core::ptr::{NonNull, Unique};
7-
use core::usize;
87

98
#[stable(feature = "alloc_module", since = "1.28.0")]
109
#[doc(inline)]

src/liballoc/collections/binary_heap.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
//! ```
2121
//! use std::cmp::Ordering;
2222
//! use std::collections::BinaryHeap;
23-
//! use std::usize;
2423
//!
2524
//! #[derive(Copy, Clone, Eq, PartialEq)]
2625
//! struct State {

src/liballoc/raw_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<T, A: Alloc> RawVec<T, A> {
5252
/// Like `new`, but parameterized over the choice of allocator for
5353
/// the returned `RawVec`.
5454
pub const fn new_in(a: A) -> Self {
55-
let cap = if mem::size_of::<T>() == 0 { core::usize::MAX } else { 0 };
55+
let cap = if mem::size_of::<T>() == 0 { usize::MAX } else { 0 };
5656

5757
// `Unique::empty()` doubles as "unallocated" and "zero-sized allocation".
5858
RawVec { ptr: Unique::empty(), cap, a }
@@ -732,7 +732,7 @@ unsafe impl<#[may_dangle] T, A: Alloc> Drop for RawVec<T, A> {
732732

733733
#[inline]
734734
fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
735-
if mem::size_of::<usize>() < 8 && alloc_size > core::isize::MAX as usize {
735+
if mem::size_of::<usize>() < 8 && alloc_size > isize::MAX as usize {
736736
Err(CapacityOverflow)
737737
} else {
738738
Ok(())

src/liballoc/rc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ use core::ops::{CoerceUnsized, Deref, DispatchFromDyn, Receiver};
250250
use core::pin::Pin;
251251
use core::ptr::{self, NonNull};
252252
use core::slice::{self, from_raw_parts_mut};
253-
use core::usize;
254253

255254
use crate::alloc::{box_free, handle_alloc_error, Alloc, Global, Layout};
256255
use crate::string::String;

src/liballoc/slice.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ use core::borrow::{Borrow, BorrowMut};
9090
use core::cmp::Ordering::{self, Less};
9191
use core::mem::{self, size_of};
9292
use core::ptr;
93-
use core::{u16, u32, u8};
9493

9594
use crate::borrow::ToOwned;
9695
use crate::boxed::Box;

src/liballoc/sync.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use core::ptr::{self, NonNull};
2323
use core::slice::{self, from_raw_parts_mut};
2424
use core::sync::atomic;
2525
use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst};
26-
use core::{isize, usize};
2726

2827
use crate::alloc::{box_free, handle_alloc_error, Alloc, Global, Layout};
2928
use crate::boxed::Box;

src/liballoc/tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use core::any::Any;
44
use core::clone::Clone;
55
use core::convert::TryInto;
66
use core::f64;
7-
use core::i64;
87
use core::ops::Deref;
98
use core::result::Result::{Err, Ok};
109

src/liballoc/tests/btree/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ fn test_range_inclusive() {
347347

348348
#[test]
349349
fn test_range_inclusive_max_value() {
350-
let max = std::usize::MAX;
350+
let max = usize::MAX;
351351
let map: BTreeMap<_, _> = vec![(max, 0)].into_iter().collect();
352352

353353
assert_eq!(map.range(max..=max).collect::<Vec<_>>(), &[(&max, &0)]);

src/liballoc/tests/string.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::borrow::Cow;
22
use std::collections::TryReserveError::*;
33
use std::mem::size_of;
4-
use std::{isize, usize};
54

65
pub trait IntoCow<'a, B: ?Sized>
76
where

0 commit comments

Comments
 (0)