Remove useless imports (#11136)

Because `TryInto`/`TryFrom` are in prelude by default from edition 2021

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
Qinxuan Chen
2022-04-04 03:44:29 +08:00
committed by GitHub
parent 98ed4afe45
commit 41c84b0b41
91 changed files with 81 additions and 176 deletions
@@ -19,7 +19,7 @@
use codec::{Decode, Encode};
use num_traits::{One, Zero};
use sp_std::{cell::RefCell, cmp::Ordering, convert::TryFrom, ops, prelude::*, vec};
use sp_std::{cell::RefCell, cmp::Ordering, ops, prelude::*, vec};
// A sensible value for this would be half of the dword size of the host machine. Since the
// runtime is compiled to 32bit webassembly, using 32 and 64 for single and double respectively
@@ -664,7 +664,6 @@ pub mod tests {
#[test]
fn can_try_build_numbers_from_types() {
use sp_std::convert::TryFrom;
assert_eq!(u64::try_from(with_limbs(1)).unwrap(), 1);
assert_eq!(u64::try_from(with_limbs(2)).unwrap(), u32::MAX as u64 + 2);
assert_eq!(u64::try_from(with_limbs(3)).unwrap_err(), "cannot fit a number into u64");
@@ -27,7 +27,6 @@ use crate::{
};
use codec::{CompactAs, Decode, Encode};
use sp_std::{
convert::{TryFrom, TryInto},
fmt::Debug,
ops::{self, Add, Div, Mul, Sub},
prelude::*,
@@ -24,7 +24,6 @@ use crate::biguint;
use num_traits::Zero;
use sp_std::{
cmp::{max, min},
convert::TryInto,
mem,
};
+1 -1
View File
@@ -44,7 +44,7 @@ pub use fixed_point::{FixedI128, FixedI64, FixedPointNumber, FixedPointOperand,
pub use per_things::{InnerOf, PerThing, PerU16, Perbill, Percent, Permill, Perquintill, UpperOf};
pub use rational::{Rational128, RationalInfinite};
use sp_std::{cmp::Ordering, convert::TryInto, fmt::Debug, prelude::*};
use sp_std::{cmp::Ordering, fmt::Debug, prelude::*};
use traits::{BaseArithmetic, One, SaturatedConversion, Unsigned, Zero};
/// Trait for comparing two numbers with an threshold.
@@ -25,7 +25,6 @@ use crate::traits::{
use codec::{CompactAs, Encode};
use num_traits::{Pow, SaturatingAdd, SaturatingSub};
use sp_std::{
convert::{TryFrom, TryInto},
fmt, ops,
ops::{Add, Sub},
prelude::*,
@@ -23,12 +23,8 @@ pub use num_traits::{
checked_pow, Bounded, CheckedAdd, CheckedDiv, CheckedMul, CheckedNeg, CheckedRem, CheckedShl,
CheckedShr, CheckedSub, One, Signed, Unsigned, Zero,
};
use sp_std::{
self,
convert::{TryFrom, TryInto},
ops::{
Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, RemAssign, Shl, Shr, Sub, SubAssign,
},
use sp_std::ops::{
Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, RemAssign, Shl, Shr, Sub, SubAssign,
};
/// A meta trait for arithmetic type operations, regardless of any limitation on size.