From fff4f083986cb5f0430a78feb139603f0ceeb9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Sat, 4 Apr 2020 17:24:03 +0200 Subject: [PATCH 1/7] Stop importing integer modules in liballoc --- src/liballoc/alloc.rs | 1 - src/liballoc/collections/binary_heap.rs | 1 - src/liballoc/rc.rs | 1 - src/liballoc/slice.rs | 1 - src/liballoc/sync.rs | 1 - src/liballoc/tests.rs | 2 -- src/liballoc/tests/string.rs | 1 - src/liballoc/tests/vec.rs | 1 - src/liballoc/tests/vec_deque.rs | 1 - 9 files changed, 10 deletions(-) diff --git a/src/liballoc/alloc.rs b/src/liballoc/alloc.rs index 66575e3ef5517..d31c73cc1bd8d 100644 --- a/src/liballoc/alloc.rs +++ b/src/liballoc/alloc.rs @@ -4,7 +4,6 @@ use core::intrinsics::{self, min_align_of_val, size_of_val}; use core::ptr::{NonNull, Unique}; -use core::usize; #[stable(feature = "alloc_module", since = "1.28.0")] #[doc(inline)] diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index 9908a3049763a..a01e9b25dd6c8 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -20,7 +20,6 @@ //! ``` //! use std::cmp::Ordering; //! use std::collections::BinaryHeap; -//! use std::usize; //! //! #[derive(Copy, Clone, Eq, PartialEq)] //! struct State { diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 6a78a7398a692..9db997e864170 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -250,7 +250,6 @@ use core::ops::{CoerceUnsized, Deref, DispatchFromDyn, Receiver}; use core::pin::Pin; use core::ptr::{self, NonNull}; use core::slice::{self, from_raw_parts_mut}; -use core::usize; use crate::alloc::{box_free, handle_alloc_error, AllocInit, AllocRef, Global, Layout}; use crate::string::String; diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 2ce5bc8ed2f9d..a3d9c78b7f58c 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -90,7 +90,6 @@ use core::borrow::{Borrow, BorrowMut}; use core::cmp::Ordering::{self, Less}; use core::mem::{self, size_of}; use core::ptr; -use core::{u16, u32, u8}; use crate::borrow::ToOwned; use crate::boxed::Box; diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 111a7651b5e77..1cfb26eb35a11 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -23,7 +23,6 @@ use core::ptr::{self, NonNull}; use core::slice::{self, from_raw_parts_mut}; use core::sync::atomic; use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst}; -use core::{isize, usize}; use crate::alloc::{box_free, handle_alloc_error, AllocInit, AllocRef, Global, Layout}; use crate::boxed::Box; diff --git a/src/liballoc/tests.rs b/src/liballoc/tests.rs index 1b6e0bb291c35..bddaab0c76188 100644 --- a/src/liballoc/tests.rs +++ b/src/liballoc/tests.rs @@ -3,8 +3,6 @@ use core::any::Any; use core::clone::Clone; use core::convert::TryInto; -use core::f64; -use core::i64; use core::ops::Deref; use core::result::Result::{Err, Ok}; diff --git a/src/liballoc/tests/string.rs b/src/liballoc/tests/string.rs index d2f09eb4a7568..6e2a5abe90d70 100644 --- a/src/liballoc/tests/string.rs +++ b/src/liballoc/tests/string.rs @@ -1,7 +1,6 @@ use std::borrow::Cow; use std::collections::TryReserveError::*; use std::mem::size_of; -use std::{isize, usize}; pub trait IntoCow<'a, B: ?Sized> where diff --git a/src/liballoc/tests/vec.rs b/src/liballoc/tests/vec.rs index 9c4ac52acac2a..831a42a4b3f3c 100644 --- a/src/liballoc/tests/vec.rs +++ b/src/liballoc/tests/vec.rs @@ -3,7 +3,6 @@ use std::collections::TryReserveError::*; use std::mem::size_of; use std::panic::{catch_unwind, AssertUnwindSafe}; use std::vec::{Drain, IntoIter}; -use std::{isize, usize}; struct DropCounter<'a> { count: &'a mut u32, diff --git a/src/liballoc/tests/vec_deque.rs b/src/liballoc/tests/vec_deque.rs index 101dd67d97a9a..c287d56fa5353 100644 --- a/src/liballoc/tests/vec_deque.rs +++ b/src/liballoc/tests/vec_deque.rs @@ -3,7 +3,6 @@ use std::collections::{vec_deque::Drain, VecDeque}; use std::fmt::Debug; use std::mem::size_of; use std::panic::{catch_unwind, AssertUnwindSafe}; -use std::{isize, usize}; use crate::hash; From a88b36b93bbd5a59f7cb2f91cb9997490b16c459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Sat, 4 Apr 2020 17:24:36 +0200 Subject: [PATCH 2/7] Stop importing int/float modules in libcore --- .../benches/num/flt2dec/strategy/dragon.rs | 1 - .../benches/num/flt2dec/strategy/grisu.rs | 1 - src/libcore/tests/fmt/num.rs | 4 -- src/libcore/tests/iter.rs | 50 ++++++++----------- src/libcore/tests/num/dec2flt/mod.rs | 2 - src/libcore/tests/num/flt2dec/mod.rs | 2 +- src/libcore/tests/num/flt2dec/random.rs | 1 - src/libcore/tests/num/int_macros.rs | 1 - 8 files changed, 23 insertions(+), 39 deletions(-) diff --git a/src/libcore/benches/num/flt2dec/strategy/dragon.rs b/src/libcore/benches/num/flt2dec/strategy/dragon.rs index 4052fec33813c..4e1fd8bf753ca 100644 --- a/src/libcore/benches/num/flt2dec/strategy/dragon.rs +++ b/src/libcore/benches/num/flt2dec/strategy/dragon.rs @@ -1,6 +1,5 @@ use super::super::*; use core::num::flt2dec::strategy::dragon::*; -use std::{f64, i16}; use test::Bencher; #[bench] diff --git a/src/libcore/benches/num/flt2dec/strategy/grisu.rs b/src/libcore/benches/num/flt2dec/strategy/grisu.rs index 495074747c283..77ca901a90af3 100644 --- a/src/libcore/benches/num/flt2dec/strategy/grisu.rs +++ b/src/libcore/benches/num/flt2dec/strategy/grisu.rs @@ -1,6 +1,5 @@ use super::super::*; use core::num::flt2dec::strategy::grisu::*; -use std::{f64, i16}; use test::Bencher; pub fn decode_finite(v: T) -> Decoded { diff --git a/src/libcore/tests/fmt/num.rs b/src/libcore/tests/fmt/num.rs index a50c2b46a919b..275a1d062cafb 100644 --- a/src/libcore/tests/fmt/num.rs +++ b/src/libcore/tests/fmt/num.rs @@ -104,7 +104,6 @@ fn test_format_int() { #[test] fn test_format_int_exp_limits() { - use core::{i128, i16, i32, i64, i8, u128, u16, u32, u64, u8}; assert_eq!(format!("{:e}", i8::MIN), "-1.28e2"); assert_eq!(format!("{:e}", i8::MAX), "1.27e2"); assert_eq!(format!("{:e}", i16::MIN), "-3.2768e4"); @@ -125,8 +124,6 @@ fn test_format_int_exp_limits() { #[test] fn test_format_int_exp_precision() { - use core::{i128, i16, i32, i64, i8}; - //test that float and integer match let big_int: u32 = 314_159_265; assert_eq!(format!("{:.1e}", big_int), format!("{:.1e}", f64::from(big_int))); @@ -214,7 +211,6 @@ fn test_format_int_sign_padding() { #[test] fn test_format_int_twos_complement() { - use core::{i16, i32, i64, i8}; assert_eq!(format!("{}", i8::MIN), "-128"); assert_eq!(format!("{}", i16::MIN), "-32768"); assert_eq!(format!("{}", i32::MIN), "-2147483648"); diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index 98e3eeb982bde..e0954a661c8d9 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -3,8 +3,6 @@ use core::cell::Cell; use core::convert::TryFrom; use core::iter::*; -use core::usize; -use core::{i16, i8, isize}; #[test] fn test_lt() { @@ -2251,62 +2249,58 @@ fn test_range_inclusive_folds() { #[test] fn test_range_size_hint() { - use core::usize::MAX as UMAX; assert_eq!((0..0usize).size_hint(), (0, Some(0))); assert_eq!((0..100usize).size_hint(), (100, Some(100))); - assert_eq!((0..UMAX).size_hint(), (UMAX, Some(UMAX))); + assert_eq!((0..usize::MAX).size_hint(), (usize::MAX, Some(usize::MAX))); - let umax = u128::try_from(UMAX).unwrap(); + let umax = u128::try_from(usize::MAX).unwrap(); assert_eq!((0..0u128).size_hint(), (0, Some(0))); assert_eq!((0..100u128).size_hint(), (100, Some(100))); - assert_eq!((0..umax).size_hint(), (UMAX, Some(UMAX))); - assert_eq!((0..umax + 1).size_hint(), (UMAX, None)); + assert_eq!((0..umax).size_hint(), (usize::MAX, Some(usize::MAX))); + assert_eq!((0..umax + 1).size_hint(), (usize::MAX, None)); - use core::isize::{MAX as IMAX, MIN as IMIN}; assert_eq!((0..0isize).size_hint(), (0, Some(0))); assert_eq!((-100..100isize).size_hint(), (200, Some(200))); - assert_eq!((IMIN..IMAX).size_hint(), (UMAX, Some(UMAX))); + assert_eq!((isize::MIN..isize::MAX).size_hint(), (usize::MAX, Some(usize::MAX))); - let imin = i128::try_from(IMIN).unwrap(); - let imax = i128::try_from(IMAX).unwrap(); + let imin = i128::try_from(isize::MIN).unwrap(); + let imax = i128::try_from(isize::MAX).unwrap(); assert_eq!((0..0i128).size_hint(), (0, Some(0))); assert_eq!((-100..100i128).size_hint(), (200, Some(200))); - assert_eq!((imin..imax).size_hint(), (UMAX, Some(UMAX))); - assert_eq!((imin..imax + 1).size_hint(), (UMAX, None)); + assert_eq!((imin..imax).size_hint(), (usize::MAX, Some(usize::MAX))); + assert_eq!((imin..imax + 1).size_hint(), (usize::MAX, None)); } #[test] fn test_range_inclusive_size_hint() { - use core::usize::MAX as UMAX; assert_eq!((1..=0usize).size_hint(), (0, Some(0))); assert_eq!((0..=0usize).size_hint(), (1, Some(1))); assert_eq!((0..=100usize).size_hint(), (101, Some(101))); - assert_eq!((0..=UMAX - 1).size_hint(), (UMAX, Some(UMAX))); - assert_eq!((0..=UMAX).size_hint(), (UMAX, None)); + assert_eq!((0..=usize::MAX - 1).size_hint(), (usize::MAX, Some(usize::MAX))); + assert_eq!((0..=usize::MAX).size_hint(), (usize::MAX, None)); - let umax = u128::try_from(UMAX).unwrap(); + let umax = u128::try_from(usize::MAX).unwrap(); assert_eq!((1..=0u128).size_hint(), (0, Some(0))); assert_eq!((0..=0u128).size_hint(), (1, Some(1))); assert_eq!((0..=100u128).size_hint(), (101, Some(101))); - assert_eq!((0..=umax - 1).size_hint(), (UMAX, Some(UMAX))); - assert_eq!((0..=umax).size_hint(), (UMAX, None)); - assert_eq!((0..=umax + 1).size_hint(), (UMAX, None)); + assert_eq!((0..=umax - 1).size_hint(), (usize::MAX, Some(usize::MAX))); + assert_eq!((0..=umax).size_hint(), (usize::MAX, None)); + assert_eq!((0..=umax + 1).size_hint(), (usize::MAX, None)); - use core::isize::{MAX as IMAX, MIN as IMIN}; assert_eq!((0..=-1isize).size_hint(), (0, Some(0))); assert_eq!((0..=0isize).size_hint(), (1, Some(1))); assert_eq!((-100..=100isize).size_hint(), (201, Some(201))); - assert_eq!((IMIN..=IMAX - 1).size_hint(), (UMAX, Some(UMAX))); - assert_eq!((IMIN..=IMAX).size_hint(), (UMAX, None)); + assert_eq!((isize::MIN..=isize::MAX - 1).size_hint(), (usize::MAX, Some(usize::MAX))); + assert_eq!((isize::MIN..=isize::MAX).size_hint(), (usize::MAX, None)); - let imin = i128::try_from(IMIN).unwrap(); - let imax = i128::try_from(IMAX).unwrap(); + let imin = i128::try_from(isize::MIN).unwrap(); + let imax = i128::try_from(isize::MAX).unwrap(); assert_eq!((0..=-1i128).size_hint(), (0, Some(0))); assert_eq!((0..=0i128).size_hint(), (1, Some(1))); assert_eq!((-100..=100i128).size_hint(), (201, Some(201))); - assert_eq!((imin..=imax - 1).size_hint(), (UMAX, Some(UMAX))); - assert_eq!((imin..=imax).size_hint(), (UMAX, None)); - assert_eq!((imin..=imax + 1).size_hint(), (UMAX, None)); + assert_eq!((imin..=imax - 1).size_hint(), (usize::MAX, Some(usize::MAX))); + assert_eq!((imin..=imax).size_hint(), (usize::MAX, None)); + assert_eq!((imin..=imax + 1).size_hint(), (usize::MAX, None)); } #[test] diff --git a/src/libcore/tests/num/dec2flt/mod.rs b/src/libcore/tests/num/dec2flt/mod.rs index a1fa5556ae5db..1c172f49c279c 100644 --- a/src/libcore/tests/num/dec2flt/mod.rs +++ b/src/libcore/tests/num/dec2flt/mod.rs @@ -1,7 +1,5 @@ #![allow(overflowing_literals)] -use std::{f32, f64, i64}; - mod parse; mod rawfp; diff --git a/src/libcore/tests/num/flt2dec/mod.rs b/src/libcore/tests/num/flt2dec/mod.rs index e945d9c4a54ce..ae892e3b0bfbf 100644 --- a/src/libcore/tests/num/flt2dec/mod.rs +++ b/src/libcore/tests/num/flt2dec/mod.rs @@ -1,4 +1,4 @@ -use std::{f32, f64, fmt, i16, str}; +use std::{fmt, str}; use core::num::flt2dec::{decode, DecodableFloat, Decoded, FullDecoded}; use core::num::flt2dec::{round_up, Formatted, Part, Sign, MAX_SIG_DIGITS}; diff --git a/src/libcore/tests/num/flt2dec/random.rs b/src/libcore/tests/num/flt2dec/random.rs index ecdfc4b30a59f..5b050a2c35631 100644 --- a/src/libcore/tests/num/flt2dec/random.rs +++ b/src/libcore/tests/num/flt2dec/random.rs @@ -1,6 +1,5 @@ #![cfg(not(target_arch = "wasm32"))] -use std::i16; use std::str; use core::num::flt2dec::strategy::grisu::format_exact_opt; diff --git a/src/libcore/tests/num/int_macros.rs b/src/libcore/tests/num/int_macros.rs index 48a49073b2cf5..8396a0dd62db9 100644 --- a/src/libcore/tests/num/int_macros.rs +++ b/src/libcore/tests/num/int_macros.rs @@ -2,7 +2,6 @@ macro_rules! int_module { ($T:ident, $T_i:ident) => { #[cfg(test)] mod tests { - use core::isize; use core::mem; use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr}; use core::$T_i::*; From fcf45999f7441721965cb3f07a996d2c11793365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Sat, 4 Apr 2020 17:25:45 +0200 Subject: [PATCH 3/7] Stop importing int/float modules in librustc_* --- src/librustc_ast/util/comments.rs | 1 - src/librustc_codegen_llvm/intrinsic.rs | 2 +- src/librustc_codegen_ssa/mir/rvalue.rs | 2 -- src/librustc_data_structures/graph/implementation/mod.rs | 1 - src/librustc_data_structures/profiling.rs | 1 - src/librustc_index/vec.rs | 1 - src/librustc_infer/infer/type_variable.rs | 1 - src/librustc_lint/types.rs | 1 - src/librustc_metadata/rmeta/decoder.rs | 1 - src/librustc_metadata/rmeta/encoder.rs | 1 - src/librustc_middle/mir/mod.rs | 2 +- src/librustc_mir/transform/promote_consts.rs | 2 +- src/librustc_mir_build/build/matches/util.rs | 1 - src/librustc_mir_build/build/mod.rs | 1 - src/librustc_mir_build/hair/pattern/_match.rs | 1 - src/librustc_passes/liveness.rs | 2 +- src/librustc_span/def_id.rs | 1 - 17 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/librustc_ast/util/comments.rs b/src/librustc_ast/util/comments.rs index 0e42ae11fa2fa..5f5d4810cb570 100644 --- a/src/librustc_ast/util/comments.rs +++ b/src/librustc_ast/util/comments.rs @@ -5,7 +5,6 @@ use rustc_span::source_map::SourceMap; use rustc_span::{BytePos, CharPos, FileName, Pos}; use log::debug; -use std::usize; #[cfg(test)] mod tests; diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 5734eae7d5946..63730c56f0ed2 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -25,7 +25,7 @@ use rustc_span::Span; use rustc_target::abi::{self, HasDataLayout, LayoutOf, Primitive}; use std::cmp::Ordering; -use std::{i128, iter, u128}; +use std::iter; fn get_simple_intrinsic(cx: &CodegenCx<'ll, '_>, name: &str) -> Option<&'ll Value> { let llvm_name = match name { diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs index 33f449ed270be..57fe7b0da6ff2 100644 --- a/src/librustc_codegen_ssa/mir/rvalue.rs +++ b/src/librustc_codegen_ssa/mir/rvalue.rs @@ -17,8 +17,6 @@ use rustc_span::source_map::{Span, DUMMY_SP}; use rustc_span::symbol::sym; use rustc_target::abi::{Abi, Int, LayoutOf, Variants}; -use std::{i128, u128}; - impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn codegen_rvalue( &mut self, diff --git a/src/librustc_data_structures/graph/implementation/mod.rs b/src/librustc_data_structures/graph/implementation/mod.rs index f705c2f0b75f3..1aa7ac024d94e 100644 --- a/src/librustc_data_structures/graph/implementation/mod.rs +++ b/src/librustc_data_structures/graph/implementation/mod.rs @@ -23,7 +23,6 @@ use crate::snapshot_vec::{SnapshotVec, SnapshotVecDelegate}; use rustc_index::bit_set::BitSet; use std::fmt::Debug; -use std::usize; #[cfg(test)] mod tests; diff --git a/src/librustc_data_structures/profiling.rs b/src/librustc_data_structures/profiling.rs index a7cdc48d60342..23f3558cbdfa3 100644 --- a/src/librustc_data_structures/profiling.rs +++ b/src/librustc_data_structures/profiling.rs @@ -93,7 +93,6 @@ use std::path::Path; use std::process; use std::sync::Arc; use std::time::{Duration, Instant}; -use std::u32; use measureme::{EventId, EventIdBuilder, SerializableString, StringId}; use parking_lot::RwLock; diff --git a/src/librustc_index/vec.rs b/src/librustc_index/vec.rs index d8c67f6210c75..a84f89c7cd950 100644 --- a/src/librustc_index/vec.rs +++ b/src/librustc_index/vec.rs @@ -7,7 +7,6 @@ use std::iter::{self, FromIterator}; use std::marker::PhantomData; use std::ops::{Index, IndexMut, Range, RangeBounds}; use std::slice; -use std::u32; use std::vec; /// Represents some newtyped `usize` wrapper. diff --git a/src/librustc_infer/infer/type_variable.rs b/src/librustc_infer/infer/type_variable.rs index 8e4199f0c263d..1de820cdb6209 100644 --- a/src/librustc_infer/infer/type_variable.rs +++ b/src/librustc_infer/infer/type_variable.rs @@ -8,7 +8,6 @@ use rustc_data_structures::unify as ut; use std::cmp; use std::marker::PhantomData; use std::ops::Range; -use std::u32; pub struct TypeVariableTable<'tcx> { values: sv::SnapshotVec, diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index a6e1ed84c8708..aa805a2f2dbc0 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -21,7 +21,6 @@ use rustc_target::spec::abi::Abi; use log::debug; use std::cmp; -use std::{f32, f64, i16, i32, i64, i8, u16, u32, u64, u8}; declare_lint! { UNUSED_COMPARISONS, diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index c59b155d5dbbc..29a4254d9eec6 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -42,7 +42,6 @@ use std::io; use std::mem; use std::num::NonZeroUsize; use std::path::Path; -use std::u32; pub use cstore_impl::{provide, provide_extern}; diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index f2e9f4d7e0b89..d75298fae0032 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -39,7 +39,6 @@ use rustc_target::abi::VariantIdx; use std::hash::Hash; use std::num::NonZeroUsize; use std::path::Path; -use std::u32; struct EncodeContext<'tcx> { opaque: opaque::Encoder, diff --git a/src/librustc_middle/mir/mod.rs b/src/librustc_middle/mir/mod.rs index 36e10f8759d17..b82008f429fa4 100644 --- a/src/librustc_middle/mir/mod.rs +++ b/src/librustc_middle/mir/mod.rs @@ -33,7 +33,7 @@ use std::borrow::Cow; use std::fmt::{self, Debug, Display, Formatter, Write}; use std::ops::Index; use std::slice; -use std::{iter, mem, option, u32}; +use std::{iter, mem, option}; pub use self::cache::{BodyAndCache, ReadOnlyBodyAndCache}; pub use self::query::*; diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 34fa12e1b5683..ec0b89ebb4d0a 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -27,7 +27,7 @@ use rustc_index::vec::{Idx, IndexVec}; use rustc_target::spec::abi::Abi; use std::cell::Cell; -use std::{cmp, iter, mem, usize}; +use std::{cmp, iter, mem}; use crate::const_eval::{is_const_fn, is_unstable_const_fn}; use crate::transform::check_consts::{is_lang_panic_fn, qualifs, ConstKind, Item}; diff --git a/src/librustc_mir_build/build/matches/util.rs b/src/librustc_mir_build/build/matches/util.rs index 967a44b9b96e4..393af108a6e46 100644 --- a/src/librustc_mir_build/build/matches/util.rs +++ b/src/librustc_mir_build/build/matches/util.rs @@ -5,7 +5,6 @@ use rustc_middle::mir::*; use rustc_middle::ty; use smallvec::SmallVec; use std::convert::TryInto; -use std::u32; impl<'a, 'tcx> Builder<'a, 'tcx> { crate fn field_match_pairs<'pat>( diff --git a/src/librustc_mir_build/build/mod.rs b/src/librustc_mir_build/build/mod.rs index 2439570202053..04cb509d44e4b 100644 --- a/src/librustc_mir_build/build/mod.rs +++ b/src/librustc_mir_build/build/mod.rs @@ -17,7 +17,6 @@ use rustc_span::symbol::kw; use rustc_span::Span; use rustc_target::spec::abi::Abi; use rustc_target::spec::PanicStrategy; -use std::u32; use super::lints; diff --git a/src/librustc_mir_build/hair/pattern/_match.rs b/src/librustc_mir_build/hair/pattern/_match.rs index 8c0843124f4f1..51ba84416d64d 100644 --- a/src/librustc_mir_build/hair/pattern/_match.rs +++ b/src/librustc_mir_build/hair/pattern/_match.rs @@ -256,7 +256,6 @@ use std::convert::TryInto; use std::fmt; use std::iter::{FromIterator, IntoIterator}; use std::ops::RangeInclusive; -use std::u128; crate fn expand_pattern<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, pat: Pat<'tcx>) -> Pat<'tcx> { LiteralExpander { tcx: cx.tcx, param_env: cx.param_env }.fold_pattern(&pat) diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs index c9060334a9a41..ee71d09cb21e9 100644 --- a/src/librustc_passes/liveness.rs +++ b/src/librustc_passes/liveness.rs @@ -112,10 +112,10 @@ use rustc_span::symbol::sym; use rustc_span::Span; use std::collections::VecDeque; +use std::fmt; use std::io; use std::io::prelude::*; use std::rc::Rc; -use std::{fmt, u32}; #[derive(Copy, Clone, PartialEq)] struct Variable(u32); diff --git a/src/librustc_span/def_id.rs b/src/librustc_span/def_id.rs index 3551220c5c54a..73b46d753d787 100644 --- a/src/librustc_span/def_id.rs +++ b/src/librustc_span/def_id.rs @@ -7,7 +7,6 @@ use rustc_macros::HashStable_Generic; use rustc_serialize::{Decoder, Encoder}; use std::borrow::Borrow; use std::fmt; -use std::{u32, u64}; rustc_index::newtype_index! { pub struct CrateId { From bc8d6c1b33f4bbc1c9e5ac3bb593a579937b7d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Sat, 4 Apr 2020 17:26:35 +0200 Subject: [PATCH 4/7] Stop importing int/float modules in libserialize --- src/libserialize/tests/json.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libserialize/tests/json.rs b/src/libserialize/tests/json.rs index c16426b5919c9..688bddc2baf46 100644 --- a/src/libserialize/tests/json.rs +++ b/src/libserialize/tests/json.rs @@ -17,7 +17,6 @@ use rustc_serialize::{Decodable, Encodable}; use std::collections::BTreeMap; use std::io::prelude::*; use std::string; -use std::{f32, f64, i64, u64}; use Animal::*; #[derive(RustcDecodable, Eq, PartialEq, Debug)] From d7f8928efd94bbdbca94195d790e6056b3e1d8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Sat, 4 Apr 2020 17:26:59 +0200 Subject: [PATCH 5/7] Stop importing int modules in librustdoc --- src/librustdoc/clean/mod.rs | 1 - src/librustdoc/passes/unindent_comments.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index e027db8b56c00..f41114839020e 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -32,7 +32,6 @@ use std::collections::hash_map::Entry; use std::default::Default; use std::hash::Hash; use std::rc::Rc; -use std::u32; use std::{mem, vec}; use crate::core::{self, DocContext, ImplTraitParam}; diff --git a/src/librustdoc/passes/unindent_comments.rs b/src/librustdoc/passes/unindent_comments.rs index d4e09ce47a3c1..5604a9c2dc163 100644 --- a/src/librustdoc/passes/unindent_comments.rs +++ b/src/librustdoc/passes/unindent_comments.rs @@ -1,6 +1,5 @@ use std::cmp; use std::string::String; -use std::usize; use crate::clean::{self, DocFragment, Item}; use crate::core::DocContext; From d0fc5d9e6b932139755e2141bfdfa7a1380925ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Sat, 4 Apr 2020 17:27:28 +0200 Subject: [PATCH 6/7] Stop importing int module in float parse test --- src/etc/test-float-parse/u64-pow2.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/etc/test-float-parse/u64-pow2.rs b/src/etc/test-float-parse/u64-pow2.rs index 1c9bda948ffd3..7e67e2b1246ef 100644 --- a/src/etc/test-float-parse/u64-pow2.rs +++ b/src/etc/test-float-parse/u64-pow2.rs @@ -1,7 +1,6 @@ mod _common; use _common::validate; -use std::u64; fn main() { for exp in 19..64 { From 101085ad9fd26a5e18f4c76dcc72b34d8edbdbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Sat, 4 Apr 2020 18:03:03 +0200 Subject: [PATCH 7/7] Stop importing integer modules in libstd --- src/libstd/sync/mpsc/shared.rs | 1 - src/libstd/sync/mpsc/stream.rs | 1 - src/libstd/sync/mpsc/sync.rs | 1 - src/libstd/sys/hermit/thread.rs | 1 - 4 files changed, 4 deletions(-) diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs index 2b0393573fdc4..c4e929624d7a4 100644 --- a/src/libstd/sync/mpsc/shared.rs +++ b/src/libstd/sync/mpsc/shared.rs @@ -12,7 +12,6 @@ use self::StartResult::*; use core::cmp; use core::intrinsics::abort; -use core::isize; use crate::cell::UnsafeCell; use crate::ptr; diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs index 2e3270e81fcd0..f33493ee0c9c9 100644 --- a/src/libstd/sync/mpsc/stream.rs +++ b/src/libstd/sync/mpsc/stream.rs @@ -11,7 +11,6 @@ use self::Message::*; pub use self::UpgradeResult::*; use core::cmp; -use core::isize; use crate::cell::UnsafeCell; use crate::ptr; diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs index 79e868171546b..3e2050799ccb4 100644 --- a/src/libstd/sync/mpsc/sync.rs +++ b/src/libstd/sync/mpsc/sync.rs @@ -26,7 +26,6 @@ use self::Blocker::*; pub use self::Failure::*; use core::intrinsics::abort; -use core::isize; use core::mem; use core::ptr; diff --git a/src/libstd/sys/hermit/thread.rs b/src/libstd/sys/hermit/thread.rs index c7bea168f34d8..34f88eea0d7c3 100644 --- a/src/libstd/sys/hermit/thread.rs +++ b/src/libstd/sys/hermit/thread.rs @@ -6,7 +6,6 @@ use crate::io; use crate::mem; use crate::sys::hermit::abi; use crate::time::Duration; -use core::u32; pub type Tid = abi::Tid;