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
+2 -2
View File
@@ -38,7 +38,7 @@ pub use secrecy::SecretString;
use sp_runtime_interface::pass_by::PassByInner;
#[doc(hidden)]
pub use sp_std::ops::Deref;
use sp_std::{convert::TryFrom, hash::Hash, str, vec::Vec};
use sp_std::{hash::Hash, str, vec::Vec};
/// Trait to zeroize a memory buffer.
pub use zeroize::Zeroize;
@@ -535,7 +535,7 @@ impl From<[u8; 32]> for AccountId32 {
}
}
impl<'a> sp_std::convert::TryFrom<&'a [u8]> for AccountId32 {
impl<'a> TryFrom<&'a [u8]> for AccountId32 {
type Error = ();
fn try_from(x: &'a [u8]) -> Result<AccountId32, ()> {
if x.len() == 32 {
+2 -2
View File
@@ -137,7 +137,7 @@ impl AsMut<[u8]> for Public {
}
}
impl sp_std::convert::TryFrom<&[u8]> for Public {
impl TryFrom<&[u8]> for Public {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -209,7 +209,7 @@ impl<'de> Deserialize<'de> for Public {
#[derive(Encode, Decode, MaxEncodedLen, PassByInner, TypeInfo, PartialEq, Eq)]
pub struct Signature(pub [u8; 65]);
impl sp_std::convert::TryFrom<&[u8]> for Signature {
impl TryFrom<&[u8]> for Signature {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
+2 -4
View File
@@ -39,8 +39,6 @@ use crate::crypto::{DeriveJunction, Pair as TraitPair, SecretStringError};
#[cfg(feature = "std")]
use bip39::{Language, Mnemonic, MnemonicType};
#[cfg(feature = "full_crypto")]
use core::convert::TryFrom;
#[cfg(feature = "full_crypto")]
use ed25519_dalek::{Signer as _, Verifier as _};
#[cfg(feature = "std")]
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
@@ -116,7 +114,7 @@ impl Deref for Public {
}
}
impl sp_std::convert::TryFrom<&[u8]> for Public {
impl TryFrom<&[u8]> for Public {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -215,7 +213,7 @@ impl<'de> Deserialize<'de> for Public {
#[derive(Encode, Decode, MaxEncodedLen, PassByInner, TypeInfo, PartialEq, Eq)]
pub struct Signature(pub [u8; 64]);
impl sp_std::convert::TryFrom<&[u8]> for Signature {
impl TryFrom<&[u8]> for Signature {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -21,10 +21,7 @@ use crate::{OpaquePeerId, RuntimeDebug};
use codec::{Decode, Encode};
use scale_info::TypeInfo;
use sp_runtime_interface::pass_by::{PassByCodec, PassByEnum, PassByInner};
use sp_std::{
convert::TryFrom,
prelude::{Box, Vec},
};
use sp_std::prelude::{Box, Vec};
pub use crate::crypto::KeyTypeId;
+2 -4
View File
@@ -35,8 +35,6 @@ use schnorrkel::{
#[cfg(feature = "full_crypto")]
use sp_std::vec::Vec;
#[cfg(feature = "std")]
use std::convert::TryFrom;
#[cfg(feature = "std")]
use substrate_bip39::mini_secret_from_entropy;
use crate::{
@@ -142,7 +140,7 @@ impl std::str::FromStr for Public {
}
}
impl sp_std::convert::TryFrom<&[u8]> for Public {
impl TryFrom<&[u8]> for Public {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -215,7 +213,7 @@ impl<'de> Deserialize<'de> for Public {
#[derive(Encode, Decode, MaxEncodedLen, PassByInner, TypeInfo, PartialEq, Eq)]
pub struct Signature(pub [u8; 64]);
impl sp_std::convert::TryFrom<&[u8]> for Signature {
impl TryFrom<&[u8]> for Signature {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {