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
+1 -1
View File
@@ -152,7 +152,7 @@ macro_rules! decl_error {
$crate::sp_runtime::DispatchError::Module($crate::sp_runtime::ModuleError {
index,
error: core::convert::TryInto::try_into(error).expect("encoded error is resized to be equal to the maximum encoded error size; qed"),
error: TryInto::try_into(error).expect("encoded error is resized to be equal to the maximum encoded error size; qed"),
message: Some(err.as_str()),
})
}
-2
View File
@@ -127,13 +127,11 @@ impl TypeId for PalletId {
macro_rules! bounded_vec {
($ ($values:expr),* $(,)?) => {
{
use $crate::sp_std::convert::TryInto as _;
$crate::sp_std::vec![$($values),*].try_into().unwrap()
}
};
( $value:expr ; $repetition:expr ) => {
{
use $crate::sp_std::convert::TryInto as _;
$crate::sp_std::vec![$value ; $repetition].try_into().unwrap()
}
}
@@ -22,10 +22,7 @@ use crate::{
traits::{Get, TryCollect},
};
use codec::{Decode, Encode, MaxEncodedLen};
use sp_std::{
borrow::Borrow, collections::btree_map::BTreeMap, convert::TryFrom, marker::PhantomData,
ops::Deref,
};
use sp_std::{borrow::Borrow, collections::btree_map::BTreeMap, marker::PhantomData, ops::Deref};
/// A bounded map based on a B-Tree.
///
@@ -22,10 +22,7 @@ use crate::{
traits::{Get, TryCollect},
};
use codec::{Decode, Encode, MaxEncodedLen};
use sp_std::{
borrow::Borrow, collections::btree_set::BTreeSet, convert::TryFrom, marker::PhantomData,
ops::Deref,
};
use sp_std::{borrow::Borrow, collections::btree_set::BTreeSet, marker::PhantomData, ops::Deref};
/// A bounded set based on a B-Tree.
///
@@ -324,7 +321,6 @@ pub mod test {
use crate::Twox128;
use frame_support::traits::ConstU32;
use sp_io::TestExternalities;
use sp_std::convert::TryInto;
crate::generate_storage_alias! { Prefix, Foo => Value<BoundedBTreeSet<u32, ConstU32<7>>> }
crate::generate_storage_alias! { Prefix, FooMap => Map<(Twox128, u32), BoundedBTreeSet<u32, ConstU32<7>>> }
@@ -27,7 +27,7 @@ use core::{
ops::{Deref, Index, IndexMut},
slice::SliceIndex,
};
use sp_std::{convert::TryFrom, marker::PhantomData, prelude::*};
use sp_std::{marker::PhantomData, prelude::*};
/// A weakly bounded vector.
///
@@ -320,7 +320,6 @@ pub mod test {
use crate::Twox128;
use frame_support::traits::ConstU32;
use sp_io::TestExternalities;
use sp_std::convert::TryInto;
crate::generate_storage_alias! { Prefix, Foo => Value<WeakBoundedVec<u32, ConstU32<7>>> }
crate::generate_storage_alias! { Prefix, FooMap => Map<(Twox128, u32), WeakBoundedVec<u32, ConstU32<7>>> }