mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 17:51:10 +00:00
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:
@@ -147,7 +147,7 @@ use sp_runtime::{
|
||||
},
|
||||
ArithmeticError, TokenError,
|
||||
};
|
||||
use sp_std::{borrow::Borrow, convert::TryInto, prelude::*};
|
||||
use sp_std::{borrow::Borrow, prelude::*};
|
||||
|
||||
use frame_support::{
|
||||
dispatch::{DispatchError, DispatchResult},
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
use frame_election_provider_support::{SortedListProvider, VoteWeight};
|
||||
use honggfuzz::fuzz;
|
||||
use pallet_bags_list::mock::{AccountId, BagsList, ExtBuilder};
|
||||
use std::convert::From;
|
||||
|
||||
const ID_RANGE: AccountId = 25_000;
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ use frame_support::{
|
||||
};
|
||||
use remote_externalities::{Builder, Mode, OnlineConfig};
|
||||
use sp_runtime::{traits::Block as BlockT, DeserializeOwned};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// Execute the sanity check of the bags-list.
|
||||
pub async fn execute<Runtime: crate::RuntimeT, Block: BlockT + DeserializeOwned>(
|
||||
|
||||
@@ -96,7 +96,6 @@ pub mod test_utils {
|
||||
}
|
||||
macro_rules! assert_return_code {
|
||||
( $x:expr , $y:expr $(,)? ) => {{
|
||||
use sp_std::convert::TryInto;
|
||||
assert_eq!(u32::from_le_bytes($x.data[..].try_into().unwrap()), $y as u32);
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use sp_runtime::{
|
||||
traits::{Saturating, Zero},
|
||||
RuntimeDebug,
|
||||
};
|
||||
use sp_std::{convert::TryFrom, prelude::*, result::Result};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// A number of lock periods, plus a vote, one way or the other.
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Default, RuntimeDebug, MaxEncodedLen)]
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
convert::TryInto,
|
||||
hash::Hash,
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
use crate::{mock::*, IndexAssignment, NposSolution};
|
||||
use frame_support::traits::ConstU32;
|
||||
use rand::SeedableRng;
|
||||
use std::convert::TryInto;
|
||||
|
||||
mod solution_type {
|
||||
use super::*;
|
||||
@@ -30,7 +29,7 @@ mod solution_type {
|
||||
// these need to come from the same dev-dependency `frame-election-provider-support`, not from
|
||||
// the crate.
|
||||
use crate::{generate_solution_type, Assignment, Error as NposError, NposSolution};
|
||||
use sp_std::{convert::TryInto, fmt::Debug};
|
||||
use sp_std::fmt::Debug;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod __private {
|
||||
|
||||
@@ -22,16 +22,12 @@ use codec::Encode;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_arithmetic::traits::{Bounded, UniqueSaturatedInto};
|
||||
use sp_npos_elections::{ElectionScore, Error, EvaluateSupport};
|
||||
use sp_std::{
|
||||
convert::{TryFrom, TryInto},
|
||||
fmt::Debug,
|
||||
prelude::*,
|
||||
};
|
||||
use sp_std::{fmt::Debug, prelude::*};
|
||||
|
||||
/// An opaque index-based, NPoS solution type.
|
||||
pub trait NposSolution
|
||||
where
|
||||
Self: Sized + for<'a> sp_std::convert::TryFrom<&'a [IndexAssignmentOf<Self>], Error = Error>,
|
||||
Self: Sized + for<'a> TryFrom<&'a [IndexAssignmentOf<Self>], Error = Error>,
|
||||
{
|
||||
/// The maximum number of votes that are allowed.
|
||||
const LIMIT: usize;
|
||||
|
||||
@@ -104,7 +104,7 @@ use sp_staking::{
|
||||
offence::{Kind, Offence, ReportOffence},
|
||||
SessionIndex,
|
||||
};
|
||||
use sp_std::{convert::TryInto, prelude::*};
|
||||
use sp_std::prelude::*;
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
pub mod sr25519 {
|
||||
|
||||
@@ -37,7 +37,7 @@ mod tests;
|
||||
pub mod weights;
|
||||
|
||||
use sp_runtime::traits::{BadOrigin, Hash, Saturating};
|
||||
use sp_std::{convert::TryFrom, prelude::*};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use frame_support::{
|
||||
|
||||
@@ -48,7 +48,7 @@ use sp_runtime::{
|
||||
traits::{Dispatchable, Hash, Saturating, TrailingZeroInput, Zero},
|
||||
DispatchResult,
|
||||
};
|
||||
use sp_std::{convert::TryInto, prelude::*};
|
||||
use sp_std::prelude::*;
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
pub use pallet::*;
|
||||
|
||||
@@ -71,7 +71,6 @@ use safe_mix::TripletMix;
|
||||
use codec::Encode;
|
||||
use frame_support::traits::Randomness;
|
||||
use sp_runtime::traits::{Hash, Saturating};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
const RANDOM_MATERIAL_LEN: u32 = 81;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ use proc_macro::TokenStream;
|
||||
use proc_macro2::{Span, TokenStream as TokenStream2};
|
||||
use proc_macro_crate::{crate_name, FoundCrate};
|
||||
use quote::{quote, ToTokens};
|
||||
use std::convert::TryInto;
|
||||
use syn::parse::{Parse, ParseStream};
|
||||
|
||||
/// Accepts a number of expressions to create a instance of PiecewiseLinear which represents the
|
||||
|
||||
@@ -316,7 +316,7 @@ use sp_staking::{
|
||||
offence::{Offence, OffenceError, ReportOffence},
|
||||
EraIndex, SessionIndex,
|
||||
};
|
||||
use sp_std::{collections::btree_map::BTreeMap, convert::From, prelude::*};
|
||||
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
pub use pallet::{pallet::*, *};
|
||||
|
||||
@@ -33,7 +33,7 @@ use sp_runtime::{
|
||||
DispatchError, Perbill, Percent,
|
||||
};
|
||||
use sp_staking::{EraIndex, SessionIndex};
|
||||
use sp_std::{cmp::max, convert::From, prelude::*};
|
||||
use sp_std::{cmp::max, prelude::*};
|
||||
|
||||
mod impls;
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ fn expand_event_conversion(
|
||||
Event::#variant_name(x)
|
||||
}
|
||||
}
|
||||
impl #scrate::sp_std::convert::TryInto<#pallet_event> for Event {
|
||||
impl TryInto<#pallet_event> for Event {
|
||||
type Error = ();
|
||||
|
||||
fn try_into(self) -> #scrate::sp_std::result::Result<#pallet_event, Self::Error> {
|
||||
|
||||
@@ -230,7 +230,7 @@ pub fn expand_outer_origin(
|
||||
}
|
||||
}
|
||||
|
||||
impl #scrate::sp_std::convert::TryFrom<OriginCaller> for #system_path::Origin<#runtime> {
|
||||
impl TryFrom<OriginCaller> for #system_path::Origin<#runtime> {
|
||||
type Error = OriginCaller;
|
||||
fn try_from(x: OriginCaller)
|
||||
-> #scrate::sp_std::result::Result<#system_path::Origin<#runtime>, OriginCaller>
|
||||
@@ -359,7 +359,7 @@ fn expand_origin_pallet_conversions(
|
||||
}
|
||||
}
|
||||
|
||||
impl #scrate::sp_std::convert::TryFrom<OriginCaller> for #pallet_origin {
|
||||
impl TryFrom<OriginCaller> for #pallet_origin {
|
||||
type Error = OriginCaller;
|
||||
fn try_from(
|
||||
x: OriginCaller,
|
||||
|
||||
@@ -162,7 +162,7 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
|
||||
#frame_support::sp_runtime::DispatchError::Module(#frame_support::sp_runtime::ModuleError {
|
||||
index,
|
||||
error: core::convert::TryInto::try_into(encoded).expect("encoded error is resized to be equal to the maximum encoded error size; qed"),
|
||||
error: TryInto::try_into(encoded).expect("encoded error is resized to be equal to the maximum encoded error size; qed"),
|
||||
message: Some(err.as_str()),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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()),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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>>> }
|
||||
|
||||
@@ -30,7 +30,7 @@ use frame_support::{
|
||||
};
|
||||
use frame_system::RawOrigin as SystemOrigin;
|
||||
use sp_runtime::traits::Bounded;
|
||||
use sp_std::{convert::TryInto, prelude::*};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
use crate::Pallet as Uniques;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ use sp_runtime::{
|
||||
},
|
||||
RuntimeDebug,
|
||||
};
|
||||
use sp_std::{convert::TryInto, fmt::Debug, prelude::*};
|
||||
use sp_std::{fmt::Debug, prelude::*};
|
||||
pub use vesting_info::*;
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user