diff --git a/substrate/bin/node/cli/src/service.rs b/substrate/bin/node/cli/src/service.rs index 038c14029cf31c1bc1f04bb16e7327132baae3a4..03e7311fb3c0136acd3626978c94f68e1c7ca0cb 100644 --- a/substrate/bin/node/cli/src/service.rs +++ b/substrate/bin/node/cli/src/service.rs @@ -562,7 +562,7 @@ mod tests { RuntimeAppPublic, }; use sp_timestamp; - use std::{borrow::Cow, convert::TryInto, sync::Arc}; + use std::{borrow::Cow, sync::Arc}; type AccountPublic = <Signature as Verify>::Signer; diff --git a/substrate/bin/node/cli/tests/common.rs b/substrate/bin/node/cli/tests/common.rs index 8391cff355969734ba1aea0a1533dc4ba7dc4d06..c17cabfa1d38a45e1ab972b653db26ec4d22ac7d 100644 --- a/substrate/bin/node/cli/tests/common.rs +++ b/substrate/bin/node/cli/tests/common.rs @@ -26,7 +26,6 @@ use nix::{ use node_primitives::Block; use remote_externalities::rpc_api; use std::{ - convert::TryInto, ops::{Deref, DerefMut}, path::Path, process::{Child, Command, ExitStatus}, diff --git a/substrate/bin/node/cli/tests/running_the_node_and_interrupt.rs b/substrate/bin/node/cli/tests/running_the_node_and_interrupt.rs index edce2bbc6e4c5dbcaeab447ca1ae302944b8755c..703123faf0e62908c8a97c7ce086f7975568e92b 100644 --- a/substrate/bin/node/cli/tests/running_the_node_and_interrupt.rs +++ b/substrate/bin/node/cli/tests/running_the_node_and_interrupt.rs @@ -25,10 +25,7 @@ use nix::{ }, unistd::Pid, }; -use std::{ - convert::TryInto, - process::{Child, Command}, -}; +use std::process::{Child, Command}; use tempfile::tempdir; pub mod common; diff --git a/substrate/bin/node/cli/tests/telemetry.rs b/substrate/bin/node/cli/tests/telemetry.rs index 212fec7a02cf690e68e74b4fb9afd3a5f29d0dca..64da4bd4b68f1bf4e94fe0ae898d99c118d7a41f 100644 --- a/substrate/bin/node/cli/tests/telemetry.rs +++ b/substrate/bin/node/cli/tests/telemetry.rs @@ -21,7 +21,7 @@ use nix::{ sys::signal::{kill, Signal::SIGINT}, unistd::Pid, }; -use std::{convert::TryInto, process}; +use std::process; pub mod common; pub mod websocket_server; diff --git a/substrate/bin/node/cli/tests/temp_base_path_works.rs b/substrate/bin/node/cli/tests/temp_base_path_works.rs index a5b9b7499fc495bc459dd25cc64dce45441a7077..306c490c2f76058327e5f24c99cf8017aeb127ac 100644 --- a/substrate/bin/node/cli/tests/temp_base_path_works.rs +++ b/substrate/bin/node/cli/tests/temp_base_path_works.rs @@ -25,7 +25,6 @@ use nix::{ }; use regex::Regex; use std::{ - convert::TryInto, io::Read, path::PathBuf, process::{Command, Stdio}, diff --git a/substrate/client/allocator/src/freeing_bump.rs b/substrate/client/allocator/src/freeing_bump.rs index d7152f5a209eadd93288e5a9c724dd49295513ed..7eeda45370b87930689ede54c73fb7f9094ce215 100644 --- a/substrate/client/allocator/src/freeing_bump.rs +++ b/substrate/client/allocator/src/freeing_bump.rs @@ -71,7 +71,6 @@ use crate::Error; pub use sp_core::MAX_POSSIBLE_ALLOCATION; use sp_wasm_interface::{Pointer, WordSize}; use std::{ - convert::{TryFrom, TryInto}, mem, ops::{Index, IndexMut, Range}, }; diff --git a/substrate/client/api/src/client.rs b/substrate/client/api/src/client.rs index 11195e1def28cbb7bdd9d9cd44e931744cb2f6f7..9c55be3238130b628a86a91d4b5c3087a2ee90f0 100644 --- a/substrate/client/api/src/client.rs +++ b/substrate/client/api/src/client.rs @@ -25,7 +25,7 @@ use sp_runtime::{ traits::{Block as BlockT, NumberFor}, Justifications, }; -use std::{collections::HashSet, convert::TryFrom, fmt, sync::Arc}; +use std::{collections::HashSet, fmt, sync::Arc}; use crate::{blockchain::Info, notifications::StorageEventStream, FinalizeSummary, ImportSummary}; diff --git a/substrate/client/authority-discovery/src/worker.rs b/substrate/client/authority-discovery/src/worker.rs index 019abaac3cfcb22ac2695bf2e8a74e3c2ac32d8b..726c032281cd8b180520dbcd1cde7f13a5b44026 100644 --- a/substrate/client/authority-discovery/src/worker.rs +++ b/substrate/client/authority-discovery/src/worker.rs @@ -24,7 +24,6 @@ use crate::{ use std::{ collections::{HashMap, HashSet}, - convert::TryInto, marker::PhantomData, sync::Arc, time::Duration, @@ -581,14 +580,11 @@ where .authorities(&id) .map_err(|e| Error::CallingRuntime(e.into()))? .into_iter() - .map(std::convert::Into::into) + .map(Into::into) .collect::<HashSet<_>>(); - let intersection = local_pub_keys - .intersection(&authorities) - .cloned() - .map(std::convert::Into::into) - .collect(); + let intersection = + local_pub_keys.intersection(&authorities).cloned().map(Into::into).collect(); Ok(intersection) } diff --git a/substrate/client/beefy/src/keystore.rs b/substrate/client/beefy/src/keystore.rs index 32478a11434fae128f1e5c6e8bfa3daf72841fc3..b0259a42075ea29a59de5509004d9c39c266da02 100644 --- a/substrate/client/beefy/src/keystore.rs +++ b/substrate/client/beefy/src/keystore.rs @@ -16,8 +16,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. -use std::convert::{From, TryInto}; - use sp_application_crypto::RuntimeAppPublic; use sp_core::keccak_256; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; diff --git a/substrate/client/cli/src/commands/insert_key.rs b/substrate/client/cli/src/commands/insert_key.rs index 852b4e50376ff6710ac122bb27327adafde60d53..68201d7b4bffcb6e187b0cf19d9d982233adf4a7 100644 --- a/substrate/client/cli/src/commands/insert_key.rs +++ b/substrate/client/cli/src/commands/insert_key.rs @@ -25,7 +25,7 @@ use sc_keystore::LocalKeystore; use sc_service::config::{BasePath, KeystoreConfig}; use sp_core::crypto::{KeyTypeId, SecretString}; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; -use std::{convert::TryFrom, sync::Arc}; +use std::sync::Arc; /// The `insert` command #[derive(Debug, Clone, Parser)] diff --git a/substrate/client/cli/src/commands/utils.rs b/substrate/client/cli/src/commands/utils.rs index d20df01e5a90e8eb2f258d47b3ae08d57587c781..fa776c25a2edab5292f8ca4a72b028d153306da4 100644 --- a/substrate/client/cli/src/commands/utils.rs +++ b/substrate/client/cli/src/commands/utils.rs @@ -31,7 +31,7 @@ use sp_core::{ Pair, }; use sp_runtime::{traits::IdentifyAccount, MultiSigner}; -use std::{convert::TryFrom, io::Read, path::PathBuf}; +use std::{io::Read, path::PathBuf}; /// Public key type for Runtime pub type PublicFor<P> = <P as sp_core::Pair>::Public; diff --git a/substrate/client/cli/src/commands/verify.rs b/substrate/client/cli/src/commands/verify.rs index a8879f42caafc075f168c3ce9a38e564112e3929..b004a948a7a4819cb706e13ac2e5395ee5ca9405 100644 --- a/substrate/client/cli/src/commands/verify.rs +++ b/substrate/client/cli/src/commands/verify.rs @@ -66,7 +66,7 @@ impl VerifyCmd { fn verify<Pair>(sig_data: Vec<u8>, message: Vec<u8>, uri: &str) -> error::Result<()> where Pair: sp_core::Pair, - Pair::Signature: for<'a> std::convert::TryFrom<&'a [u8]>, + Pair::Signature: for<'a> TryFrom<&'a [u8]>, { let signature = Pair::Signature::try_from(&sig_data).map_err(|_| error::Error::SignatureFormatInvalid)?; diff --git a/substrate/client/cli/src/error.rs b/substrate/client/cli/src/error.rs index 69b2eeaaf6186656833c24f84058efd0907d8ab1..f38a95e0115f156c8baee037823212c2f1f8434b 100644 --- a/substrate/client/cli/src/error.rs +++ b/substrate/client/cli/src/error.rs @@ -80,19 +80,19 @@ pub enum Error { GlobalLoggerError(#[from] sc_tracing::logging::Error), } -impl std::convert::From<&str> for Error { +impl From<&str> for Error { fn from(s: &str) -> Error { Error::Input(s.to_string()) } } -impl std::convert::From<String> for Error { +impl From<String> for Error { fn from(s: String) -> Error { Error::Input(s) } } -impl std::convert::From<crypto::PublicError> for Error { +impl From<crypto::PublicError> for Error { fn from(e: crypto::PublicError) -> Error { Error::InvalidUri(e) } diff --git a/substrate/client/cli/src/params/mod.rs b/substrate/client/cli/src/params/mod.rs index e0571aa4bbbf8be6a2a330b651e9dc165e450cbe..33e714ec138b088827ce59da74f290ab8e1a989b 100644 --- a/substrate/client/cli/src/params/mod.rs +++ b/substrate/client/cli/src/params/mod.rs @@ -32,7 +32,7 @@ use sp_runtime::{ generic::BlockId, traits::{Block as BlockT, NumberFor}, }; -use std::{convert::TryFrom, fmt::Debug, str::FromStr}; +use std::{fmt::Debug, str::FromStr}; pub use crate::params::{ database_params::*, import_params::*, keystore_params::*, network_params::*, diff --git a/substrate/client/consensus/aura/src/lib.rs b/substrate/client/consensus/aura/src/lib.rs index 4d91eaaae92ab756e28a1397f7193d3bf6f59a61..f6ea2e08e1e88af0a9528bd404c28b4eef30e219 100644 --- a/substrate/client/consensus/aura/src/lib.rs +++ b/substrate/client/consensus/aura/src/lib.rs @@ -30,14 +30,7 @@ //! //! NOTE: Aura itself is designed to be generic over the crypto used. #![forbid(missing_docs, unsafe_code)] -use std::{ - convert::{TryFrom, TryInto}, - fmt::Debug, - hash::Hash, - marker::PhantomData, - pin::Pin, - sync::Arc, -}; +use std::{fmt::Debug, hash::Hash, marker::PhantomData, pin::Pin, sync::Arc}; use futures::prelude::*; use log::{debug, trace}; @@ -517,7 +510,7 @@ pub enum Error<B: BlockT> { Inherent(sp_inherents::Error), } -impl<B: BlockT> std::convert::From<Error<B>> for String { +impl<B: BlockT> From<Error<B>> for String { fn from(error: Error<B>) -> String { error.to_string() } diff --git a/substrate/client/consensus/babe/src/lib.rs b/substrate/client/consensus/babe/src/lib.rs index 4f3139a013d4b9a7a5c192514cbd975ab992a878..818384a5c3d7e718127ead115e66f3ae585865bf 100644 --- a/substrate/client/consensus/babe/src/lib.rs +++ b/substrate/client/consensus/babe/src/lib.rs @@ -69,7 +69,6 @@ use std::{ borrow::Cow, collections::{HashMap, HashSet}, - convert::TryInto, future::Future, pin::Pin, sync::Arc, @@ -320,7 +319,7 @@ pub enum Error<B: BlockT> { ForkTree(Box<fork_tree::Error<sp_blockchain::Error>>), } -impl<B: BlockT> std::convert::From<Error<B>> for String { +impl<B: BlockT> From<Error<B>> for String { fn from(error: Error<B>) -> String { error.to_string() } diff --git a/substrate/client/consensus/manual-seal/src/error.rs b/substrate/client/consensus/manual-seal/src/error.rs index 2f946f3de3ccc62e926b64819164a1757fc0e121..7c3211203bf546210adcf8706ea5e0d077a8c947 100644 --- a/substrate/client/consensus/manual-seal/src/error.rs +++ b/substrate/client/consensus/manual-seal/src/error.rs @@ -102,7 +102,7 @@ impl Error { } } -impl std::convert::From<Error> for jsonrpc_core::Error { +impl From<Error> for jsonrpc_core::Error { fn from(error: Error) -> Self { jsonrpc_core::Error { code: jsonrpc_core::ErrorCode::ServerError(error.to_code()), diff --git a/substrate/client/consensus/pow/src/lib.rs b/substrate/client/consensus/pow/src/lib.rs index 6d0bc3fc5a19214b2518a59a07634896b9dbb2d2..8885099ceb514e782800e8d3050b87a62e469547 100644 --- a/substrate/client/consensus/pow/src/lib.rs +++ b/substrate/client/consensus/pow/src/lib.rs @@ -119,13 +119,13 @@ pub enum Error<B: BlockT> { Other(String), } -impl<B: BlockT> std::convert::From<Error<B>> for String { +impl<B: BlockT> From<Error<B>> for String { fn from(error: Error<B>) -> String { error.to_string() } } -impl<B: BlockT> std::convert::From<Error<B>> for ConsensusError { +impl<B: BlockT> From<Error<B>> for ConsensusError { fn from(error: Error<B>) -> ConsensusError { ConsensusError::ClientImport(error.to_string()) } diff --git a/substrate/client/db/src/utils.rs b/substrate/client/db/src/utils.rs index 29aa8424221a627b083d1542f73c06f467d1ad10..1798838ecc155435e39d47430e0c19451cdbd35e 100644 --- a/substrate/client/db/src/utils.rs +++ b/substrate/client/db/src/utils.rs @@ -19,7 +19,7 @@ //! Db-based backend utility structures and functions, used by both //! full and light storages. -use std::{convert::TryInto, fmt, fs, io, path::Path, sync::Arc}; +use std::{fmt, fs, io, path::Path, sync::Arc}; use log::{debug, info}; diff --git a/substrate/client/executor/common/src/sandbox/wasmer_backend.rs b/substrate/client/executor/common/src/sandbox/wasmer_backend.rs index dfb26c4a8dedbd88f8ce7cf41222ca0f9d0b887f..904afc9470400cbad383e733643894ce460f74d2 100644 --- a/substrate/client/executor/common/src/sandbox/wasmer_backend.rs +++ b/substrate/client/executor/common/src/sandbox/wasmer_backend.rs @@ -26,7 +26,7 @@ use crate::{ use codec::{Decode, Encode}; use sp_core::sandbox::HostError; use sp_wasm_interface::{FunctionContext, Pointer, ReturnValue, Value, WordSize}; -use std::{cell::RefCell, collections::HashMap, convert::TryInto, rc::Rc}; +use std::{cell::RefCell, collections::HashMap, rc::Rc}; use wasmer::RuntimeError; use crate::sandbox::{ diff --git a/substrate/client/finality-grandpa/rpc/src/lib.rs b/substrate/client/finality-grandpa/rpc/src/lib.rs index bde2e5612b2e6da3c96b49b5cc4a9065442f86b0..9c51bc3d226a700cb2ce8cf28286e1dd941fd42f 100644 --- a/substrate/client/finality-grandpa/rpc/src/lib.rs +++ b/substrate/client/finality-grandpa/rpc/src/lib.rs @@ -171,7 +171,7 @@ where mod tests { use super::*; use jsonrpc_core::{types::Params, Notification, Output}; - use std::{collections::HashSet, convert::TryInto, sync::Arc}; + use std::{collections::HashSet, sync::Arc}; use parity_scale_codec::{Decode, Encode}; use sc_block_builder::{BlockBuilder, RecordProof}; diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index 8d76939fddd6fc24f7986062f52faaa454d94639..77b28dec5565194a6dfc3542bfab58ad59061606 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -22,11 +22,7 @@ use log::info; use sc_client_api::ClientInfo; use sc_network::{NetworkStatus, SyncState, WarpSyncPhase, WarpSyncProgress}; use sp_runtime::traits::{Block as BlockT, CheckedDiv, NumberFor, Saturating, Zero}; -use std::{ - convert::{TryFrom, TryInto}, - fmt, - time::Instant, -}; +use std::{fmt, time::Instant}; /// State of the informant display system. /// diff --git a/substrate/client/network-gossip/src/bridge.rs b/substrate/client/network-gossip/src/bridge.rs index f72cd156165158834d45b1cc495f35a71c19ee90..2e09e7cc614a4751dfa4a04a7af4fa59d60369f9 100644 --- a/substrate/client/network-gossip/src/bridge.rs +++ b/substrate/client/network-gossip/src/bridge.rs @@ -303,7 +303,6 @@ mod tests { use sp_runtime::{testing::H256, traits::Block as BlockT}; use std::{ borrow::Cow, - convert::TryInto, sync::{Arc, Mutex}, }; use substrate_test_runtime_client::runtime::Block; diff --git a/substrate/client/network/src/config.rs b/substrate/client/network/src/config.rs index eedf3fc22b9610ed996bdc65ba7cfaeb54f41226..7c2dfef7fe89c3b09b6d5c671725ea1c219f5d5c 100644 --- a/substrate/client/network/src/config.rs +++ b/substrate/client/network/src/config.rs @@ -50,7 +50,6 @@ use sp_runtime::traits::Block as BlockT; use std::{ borrow::Cow, collections::HashMap, - convert::TryFrom, error::Error, fs, future::Future, diff --git a/substrate/client/network/src/protocol.rs b/substrate/client/network/src/protocol.rs index c00d4302f827cea027ea6397f56043ce9d4e24da..80694210e77dc0f24d5c0d8f86641d899311af4e 100644 --- a/substrate/client/network/src/protocol.rs +++ b/substrate/client/network/src/protocol.rs @@ -60,7 +60,6 @@ use sp_runtime::{ use std::{ borrow::Cow, collections::{HashMap, HashSet, VecDeque}, - convert::TryFrom as _, io, iter, num::NonZeroUsize, pin::Pin, diff --git a/substrate/client/network/src/protocol/notifications/upgrade/notifications.rs b/substrate/client/network/src/protocol/notifications/upgrade/notifications.rs index 53270975a5b0dfb56663342a1ce4c322defd40e3..3fbb59d399a0e4fc6e31d2db0d5f6c9b6fd0441d 100644 --- a/substrate/client/network/src/protocol/notifications/upgrade/notifications.rs +++ b/substrate/client/network/src/protocol/notifications/upgrade/notifications.rs @@ -41,7 +41,7 @@ use libp2p::core::{upgrade, InboundUpgrade, OutboundUpgrade, UpgradeInfo}; use log::{error, warn}; use std::{ borrow::Cow, - convert::{Infallible, TryFrom as _}, + convert::Infallible, io, mem, pin::Pin, task::{Context, Poll}, diff --git a/substrate/client/network/src/request_responses.rs b/substrate/client/network/src/request_responses.rs index 58007c7bc5ce1c2f204c09802b60f6f4040591eb..4613a15af93669be404d6cacfc068c2894b18f40 100644 --- a/substrate/client/network/src/request_responses.rs +++ b/substrate/client/network/src/request_responses.rs @@ -56,7 +56,6 @@ use libp2p::{ use std::{ borrow::Cow, collections::{hash_map::Entry, HashMap}, - convert::TryFrom as _, io, iter, pin::Pin, task::{Context, Poll}, diff --git a/substrate/client/network/src/service.rs b/substrate/client/network/src/service.rs index a02aa982318a9b3c4cd9be844ca5c4c39d0a54f0..e89be325fa486d0eb474d8406d6f30ba73a77d1d 100644 --- a/substrate/client/network/src/service.rs +++ b/substrate/client/network/src/service.rs @@ -73,7 +73,6 @@ use std::{ borrow::Cow, cmp, collections::{HashMap, HashSet}, - convert::TryFrom as _, fs, iter, marker::PhantomData, num::NonZeroUsize, diff --git a/substrate/client/network/src/service/out_events.rs b/substrate/client/network/src/service/out_events.rs index 1fe13bc30faff047de1763229626324cfcb9c307..3bff5a16fd0c2fc422374a71d147312f79cf4180 100644 --- a/substrate/client/network/src/service/out_events.rs +++ b/substrate/client/network/src/service/out_events.rs @@ -38,7 +38,6 @@ use parking_lot::Mutex; use prometheus_endpoint::{register, CounterVec, GaugeVec, Opts, PrometheusError, Registry, U64}; use std::{ cell::RefCell, - convert::TryFrom as _, fmt, pin::Pin, sync::Arc, diff --git a/substrate/client/offchain/src/api.rs b/substrate/client/offchain/src/api.rs index 30c7969279ee2db4b195c20314029c115f815927..c80b511c84d173f39492f483919f400963ec93f4 100644 --- a/substrate/client/offchain/src/api.rs +++ b/substrate/client/offchain/src/api.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. -use std::{collections::HashSet, convert::TryFrom, str::FromStr, sync::Arc, thread::sleep}; +use std::{collections::HashSet, str::FromStr, sync::Arc, thread::sleep}; use crate::NetworkProvider; use codec::{Decode, Encode}; @@ -327,10 +327,7 @@ mod tests { use sc_client_db::offchain::LocalStorage; use sc_network::{NetworkStateInfo, PeerId}; use sp_core::offchain::{DbExternalities, Externalities}; - use std::{ - convert::{TryFrom, TryInto}, - time::SystemTime, - }; + use std::time::SystemTime; pub(super) struct TestNetwork(); diff --git a/substrate/client/offchain/src/api/http.rs b/substrate/client/offchain/src/api/http.rs index 2a7514116cb5dbabe9201e7bfe835dd220cec6f3..012de78c5f645ea23d7e1a58cd122b47b5e9dee4 100644 --- a/substrate/client/offchain/src/api/http.rs +++ b/substrate/client/offchain/src/api/http.rs @@ -37,7 +37,6 @@ use once_cell::sync::Lazy; use sc_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; use sp_core::offchain::{HttpError, HttpRequestId, HttpRequestStatus, Timestamp}; use std::{ - convert::TryFrom, fmt, io::Read as _, pin::Pin, diff --git a/substrate/client/offchain/src/api/timestamp.rs b/substrate/client/offchain/src/api/timestamp.rs index 6622331f570dfb13638990f23a9cb534cad683b7..4b3f5efddf2752efcda6e7b5ab1b6f57bc09498b 100644 --- a/substrate/client/offchain/src/api/timestamp.rs +++ b/substrate/client/offchain/src/api/timestamp.rs @@ -19,10 +19,7 @@ //! Helper methods dedicated to timestamps. use sp_core::offchain::Timestamp; -use std::{ - convert::TryInto, - time::{Duration, SystemTime}, -}; +use std::time::{Duration, SystemTime}; /// Returns the current time as a `Timestamp`. pub fn now() -> Timestamp { diff --git a/substrate/client/rpc/src/author/mod.rs b/substrate/client/rpc/src/author/mod.rs index 2b604d2897c586f4dbb4a00975dac3f1cb71fefe..5064e61342101bd4e730ca176291405a83dd6120 100644 --- a/substrate/client/rpc/src/author/mod.rs +++ b/substrate/client/rpc/src/author/mod.rs @@ -21,7 +21,7 @@ #[cfg(test)] mod tests; -use std::{convert::TryInto, sync::Arc}; +use std::sync::Arc; use sp_blockchain::HeaderBackend; diff --git a/substrate/client/service/src/chain_ops/import_blocks.rs b/substrate/client/service/src/chain_ops/import_blocks.rs index dc03cdcedae061d503ef8b34308b8bc61874bf7f..c0612124dd0c249e06fc3b061474ef76ba642e9a 100644 --- a/substrate/client/service/src/chain_ops/import_blocks.rs +++ b/substrate/client/service/src/chain_ops/import_blocks.rs @@ -35,7 +35,6 @@ use sp_runtime::{ }, }; use std::{ - convert::{TryFrom, TryInto}, io::Read, pin::Pin, task::Poll, diff --git a/substrate/client/service/src/config.rs b/substrate/client/service/src/config.rs index fd32aebdebdd807841ba268518964f53674f5ca0..7c7bb480aa5c353aeb85d6ae2ea8e0743a91f720 100644 --- a/substrate/client/service/src/config.rs +++ b/substrate/client/service/src/config.rs @@ -294,7 +294,7 @@ impl BasePath { } } -impl std::convert::From<PathBuf> for BasePath { +impl From<PathBuf> for BasePath { fn from(path: PathBuf) -> Self { BasePath::new(path) } diff --git a/substrate/client/service/src/metrics.rs b/substrate/client/service/src/metrics.rs index 02e3ab95f11873d8b08cdf9f191e74f80908cb47..9fbf2c3ea3fca830f29af1160795f0d317cdca78 100644 --- a/substrate/client/service/src/metrics.rs +++ b/substrate/client/service/src/metrics.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. -use std::{convert::TryFrom, time::SystemTime}; +use std::time::SystemTime; use crate::config::Configuration; use futures_timer::Delay; diff --git a/substrate/client/transaction-pool/src/lib.rs b/substrate/client/transaction-pool/src/lib.rs index ec93d1f7c51fe82a7c6d63f6c8ad071c5d512c81..9fd2ef1deef430694f35bb90c4ca351fa05b5d4b 100644 --- a/substrate/client/transaction-pool/src/lib.rs +++ b/substrate/client/transaction-pool/src/lib.rs @@ -40,7 +40,6 @@ pub use graph::{base_pool::Limit as PoolLimit, ChainApi, Options, Pool, Transact use parking_lot::Mutex; use std::{ collections::{HashMap, HashSet}, - convert::TryInto, pin::Pin, sync::Arc, }; diff --git a/substrate/client/transaction-pool/tests/pool.rs b/substrate/client/transaction-pool/tests/pool.rs index 08ecdbc86cca4a3b757c5d8e1baaaf223ad2aa17..2243f140cb22d7941a5cf6ae7c8e2a62cc0a597d 100644 --- a/substrate/client/transaction-pool/tests/pool.rs +++ b/substrate/client/transaction-pool/tests/pool.rs @@ -36,7 +36,7 @@ use sp_runtime::{ traits::Block as _, transaction_validity::{InvalidTransaction, TransactionSource, ValidTransaction}, }; -use std::{collections::BTreeSet, convert::TryInto, sync::Arc}; +use std::{collections::BTreeSet, sync::Arc}; use substrate_test_runtime_client::{ runtime::{Block, Extrinsic, Hash, Header, Index, Transfer}, AccountKeyring::*, @@ -864,8 +864,6 @@ fn ready_set_should_eventually_resolve_when_block_update_arrives() { #[test] fn should_not_accept_old_signatures() { - use std::convert::TryFrom; - let client = Arc::new(substrate_test_runtime_client::new()); let pool = Arc::new( diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 71ba7b4d2491037c1c503b41c19ff5308bf92048..9b0f23a0a17832beee9f40ccf911e474d8050ee9 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -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}, diff --git a/substrate/frame/bags-list/fuzzer/src/main.rs b/substrate/frame/bags-list/fuzzer/src/main.rs index 3ff59b450befa60a17d5afae28a47e76774750aa..6f538eb28e7e494756f30a632e28c2e186afba63 100644 --- a/substrate/frame/bags-list/fuzzer/src/main.rs +++ b/substrate/frame/bags-list/fuzzer/src/main.rs @@ -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; diff --git a/substrate/frame/bags-list/remote-tests/src/sanity_check.rs b/substrate/frame/bags-list/remote-tests/src/sanity_check.rs index f2b6881edea7f4da631011dbd3a8128289eeddc6..1027efb8539ee5d4367ac2a82ca2952450ab79ac 100644 --- a/substrate/frame/bags-list/remote-tests/src/sanity_check.rs +++ b/substrate/frame/bags-list/remote-tests/src/sanity_check.rs @@ -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>( diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index 2b01cbe3c742967da9cdf01458f4a0370b989e44..ce59f5bb858ac0ef581cf881d85f8ea661f4e4f9 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -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); }}; } diff --git a/substrate/frame/conviction-voting/src/vote.rs b/substrate/frame/conviction-voting/src/vote.rs index d7ca931de35a1b1d8e92021e03b1c7fa627e1940..e608a6dcfd01b09ac05d0928e6f3783aec57f060 100644 --- a/substrate/frame/conviction-voting/src/vote.rs +++ b/substrate/frame/conviction-voting/src/vote.rs @@ -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)] diff --git a/substrate/frame/election-provider-support/src/mock.rs b/substrate/frame/election-provider-support/src/mock.rs index d10b1724c95d8d930689cb2c87642f88f54789c7..7c834f06f3cdf8db6ff1e20494dd622bd4c84e27 100644 --- a/substrate/frame/election-provider-support/src/mock.rs +++ b/substrate/frame/election-provider-support/src/mock.rs @@ -21,7 +21,6 @@ use std::{ collections::{HashMap, HashSet}, - convert::TryInto, hash::Hash, }; diff --git a/substrate/frame/election-provider-support/src/tests.rs b/substrate/frame/election-provider-support/src/tests.rs index f88f3653c681c8865e08b2476026e7925d5645f1..1ccff79f3efd4185801558d3f1474d86d506edb7 100644 --- a/substrate/frame/election-provider-support/src/tests.rs +++ b/substrate/frame/election-provider-support/src/tests.rs @@ -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 { diff --git a/substrate/frame/election-provider-support/src/traits.rs b/substrate/frame/election-provider-support/src/traits.rs index e1fc0663e7d1e94fac3b19cc476dd73332ec28ff..ed812e2e0f2c4108807aaf320ef63effb724bd6d 100644 --- a/substrate/frame/election-provider-support/src/traits.rs +++ b/substrate/frame/election-provider-support/src/traits.rs @@ -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; diff --git a/substrate/frame/im-online/src/lib.rs b/substrate/frame/im-online/src/lib.rs index e2213ef4169b10e59d971af988d1fda810889852..5ef515db0b2366c5ac28a8b6642856f478d58fed 100644 --- a/substrate/frame/im-online/src/lib.rs +++ b/substrate/frame/im-online/src/lib.rs @@ -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 { diff --git a/substrate/frame/preimage/src/lib.rs b/substrate/frame/preimage/src/lib.rs index c34057a1034d32f1d2eb08271664abecb71650e5..a5d8ee28b595257911a17183ab8bb6731eecc6cc 100644 --- a/substrate/frame/preimage/src/lib.rs +++ b/substrate/frame/preimage/src/lib.rs @@ -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::{ diff --git a/substrate/frame/proxy/src/lib.rs b/substrate/frame/proxy/src/lib.rs index 84f1a84badc90589370e945d0e7b89b78b1aa6de..891315c92aa39492dd1c8329d898ed99066f38d5 100644 --- a/substrate/frame/proxy/src/lib.rs +++ b/substrate/frame/proxy/src/lib.rs @@ -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::*; diff --git a/substrate/frame/randomness-collective-flip/src/lib.rs b/substrate/frame/randomness-collective-flip/src/lib.rs index b72aa665550cf788f98c7d0778014c247394b96a..f709578f6941a4a6b514254d6f8c3689b152a5ac 100644 --- a/substrate/frame/randomness-collective-flip/src/lib.rs +++ b/substrate/frame/randomness-collective-flip/src/lib.rs @@ -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; diff --git a/substrate/frame/staking/reward-curve/src/lib.rs b/substrate/frame/staking/reward-curve/src/lib.rs index 9b2f3100b487e29c5954a9d5450b8e7fb65cf69f..e66f6fde37599ac813838c6a1d3f756af327254a 100644 --- a/substrate/frame/staking/reward-curve/src/lib.rs +++ b/substrate/frame/staking/reward-curve/src/lib.rs @@ -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 diff --git a/substrate/frame/staking/src/lib.rs b/substrate/frame/staking/src/lib.rs index 2a0716721dd5111671de4e1bd6226808c58e7e2f..872ed2e1af4049519a9f5ac3d3059e9b8df9252f 100644 --- a/substrate/frame/staking/src/lib.rs +++ b/substrate/frame/staking/src/lib.rs @@ -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::*, *}; diff --git a/substrate/frame/staking/src/pallet/mod.rs b/substrate/frame/staking/src/pallet/mod.rs index 306bd34390d82d724d28985f3182b727c7631334..fa8c453c2b0fe3dbcd35e77a385b2deed8e98d04 100644 --- a/substrate/frame/staking/src/pallet/mod.rs +++ b/substrate/frame/staking/src/pallet/mod.rs @@ -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; diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/event.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/event.rs index ef071a9fc7ef591e2003116dcf8a88cfdb37c6ac..b242f9641562c039b17bf385ff46cf1282d1cb0b 100644 --- a/substrate/frame/support/procedural/src/construct_runtime/expand/event.rs +++ b/substrate/frame/support/procedural/src/construct_runtime/expand/event.rs @@ -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> { diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs index 077bef3744a5a8ba640958874f8173867dba741c..342a002b52b9df313b2616a3a76bc6d608868086 100644 --- a/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs +++ b/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs @@ -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, diff --git a/substrate/frame/support/procedural/src/pallet/expand/error.rs b/substrate/frame/support/procedural/src/pallet/expand/error.rs index 86b06d737decff6b41f5fbdb70fb46402d970b80..124e8b312ce39ffda9bc128106e331b14f16dba5 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/error.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/error.rs @@ -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()), }) } diff --git a/substrate/frame/support/src/error.rs b/substrate/frame/support/src/error.rs index 764376a4e1dc2159544f5ed2510ef9b6f3ebffb7..0ffe4334e2e3042a13d6bcaf6425660f1d734005 100644 --- a/substrate/frame/support/src/error.rs +++ b/substrate/frame/support/src/error.rs @@ -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()), }) } diff --git a/substrate/frame/support/src/lib.rs b/substrate/frame/support/src/lib.rs index 70a79c07189dc01169911f81e64fa3ab7b8c00b8..714449eec784703e53b2336c215bfc2857f8328f 100644 --- a/substrate/frame/support/src/lib.rs +++ b/substrate/frame/support/src/lib.rs @@ -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() } } diff --git a/substrate/frame/support/src/storage/bounded_btree_map.rs b/substrate/frame/support/src/storage/bounded_btree_map.rs index 6190552476a45d3dfcff0a0838ab1cee35cfc457..eca4b17821c779339170365d84ab13e76eed7fde 100644 --- a/substrate/frame/support/src/storage/bounded_btree_map.rs +++ b/substrate/frame/support/src/storage/bounded_btree_map.rs @@ -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. /// diff --git a/substrate/frame/support/src/storage/bounded_btree_set.rs b/substrate/frame/support/src/storage/bounded_btree_set.rs index 543b997e94e3489297d7af615dbcd058ae613f3d..f38952bf545d9ed42b22c3f6c42aed2965985437 100644 --- a/substrate/frame/support/src/storage/bounded_btree_set.rs +++ b/substrate/frame/support/src/storage/bounded_btree_set.rs @@ -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>>> } diff --git a/substrate/frame/support/src/storage/weak_bounded_vec.rs b/substrate/frame/support/src/storage/weak_bounded_vec.rs index aa6dc88eaa4f4b79c881bb26309f7be8936cfeed..21cc487b490821ade9ca39adb1baf3ea347f256b 100644 --- a/substrate/frame/support/src/storage/weak_bounded_vec.rs +++ b/substrate/frame/support/src/storage/weak_bounded_vec.rs @@ -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>>> } diff --git a/substrate/frame/uniques/src/benchmarking.rs b/substrate/frame/uniques/src/benchmarking.rs index d6223ec88f81b9a5de19a594ceeee71df588bf6b..19d3dfac6e5ac9f76928ae810a85a1ff679b22f0 100644 --- a/substrate/frame/uniques/src/benchmarking.rs +++ b/substrate/frame/uniques/src/benchmarking.rs @@ -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; diff --git a/substrate/frame/vesting/src/lib.rs b/substrate/frame/vesting/src/lib.rs index 775902f223ba05cb8060c38cf530f1cd33a07b69..13841a0443ceba9708caebd13cd1fc3d4ee7dbbd 100644 --- a/substrate/frame/vesting/src/lib.rs +++ b/substrate/frame/vesting/src/lib.rs @@ -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; diff --git a/substrate/primitives/application-crypto/src/lib.rs b/substrate/primitives/application-crypto/src/lib.rs index b12fe72b271a6e9f2a24888825e6028623e2c002..05f89c40ef99fc617da858834f0780f1c1c2f29d 100644 --- a/substrate/primitives/application-crypto/src/lib.rs +++ b/substrate/primitives/application-crypto/src/lib.rs @@ -42,7 +42,7 @@ pub use scale_info; #[cfg(feature = "std")] pub use serde; #[doc(hidden)] -pub use sp_std::{convert::TryFrom, ops::Deref, vec::Vec}; +pub use sp_std::{ops::Deref, vec::Vec}; pub mod ecdsa; pub mod ed25519; @@ -363,7 +363,7 @@ macro_rules! app_crypto_public_common { } } - impl<'a> $crate::TryFrom<&'a [u8]> for Public { + impl<'a> TryFrom<&'a [u8]> for Public { type Error = (); fn try_from(data: &'a [u8]) -> Result<Self, Self::Error> { @@ -518,7 +518,7 @@ macro_rules! app_crypto_signature_common { type Generic = $sig; } - impl<'a> $crate::TryFrom<&'a [u8]> for Signature { + impl<'a> TryFrom<&'a [u8]> for Signature { type Error = (); fn try_from(data: &'a [u8]) -> Result<Self, Self::Error> { @@ -526,7 +526,7 @@ macro_rules! app_crypto_signature_common { } } - impl $crate::TryFrom<$crate::Vec<u8>> for Signature { + impl TryFrom<$crate::Vec<u8>> for Signature { type Error = (); fn try_from(data: $crate::Vec<u8>) -> Result<Self, Self::Error> { diff --git a/substrate/primitives/arithmetic/fuzzer/src/biguint.rs b/substrate/primitives/arithmetic/fuzzer/src/biguint.rs index e4c088a2e8ab3242af0efee6bcaf0cc16f835aef..f49743a4b8a694c442fe26e9b9cf2377534d27b0 100644 --- a/substrate/primitives/arithmetic/fuzzer/src/biguint.rs +++ b/substrate/primitives/arithmetic/fuzzer/src/biguint.rs @@ -29,7 +29,6 @@ use honggfuzz::fuzz; use sp_arithmetic::biguint::{BigUint, Single}; -use std::convert::TryFrom; fn main() { loop { diff --git a/substrate/primitives/arithmetic/fuzzer/src/normalize.rs b/substrate/primitives/arithmetic/fuzzer/src/normalize.rs index e4f90dbc1c415c636f9290d8d269fb83401acd58..dd717115a5c9cabb9deece2ec198ec9c32796b59 100644 --- a/substrate/primitives/arithmetic/fuzzer/src/normalize.rs +++ b/substrate/primitives/arithmetic/fuzzer/src/normalize.rs @@ -25,7 +25,6 @@ use honggfuzz::fuzz; use sp_arithmetic::Normalizable; -use std::convert::TryInto; type Ty = u64; diff --git a/substrate/primitives/arithmetic/src/biguint.rs b/substrate/primitives/arithmetic/src/biguint.rs index b26ac4294d111479320cb6aa0dfe19f3e1c6fb89..33f0960ee378c228e133c4061d4424b896102305 100644 --- a/substrate/primitives/arithmetic/src/biguint.rs +++ b/substrate/primitives/arithmetic/src/biguint.rs @@ -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"); diff --git a/substrate/primitives/arithmetic/src/fixed_point.rs b/substrate/primitives/arithmetic/src/fixed_point.rs index 1c61d6c3806aee7eda9fccb02eef5a98d0b3c432..3ecfb60ee0f52233751d19242bfd5f4a84b521ee 100644 --- a/substrate/primitives/arithmetic/src/fixed_point.rs +++ b/substrate/primitives/arithmetic/src/fixed_point.rs @@ -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::*, diff --git a/substrate/primitives/arithmetic/src/helpers_128bit.rs b/substrate/primitives/arithmetic/src/helpers_128bit.rs index af9729c9702c35893e63d67906faeb1c3b20ea88..735b11287cbe45072be665783f38f735954a0f10 100644 --- a/substrate/primitives/arithmetic/src/helpers_128bit.rs +++ b/substrate/primitives/arithmetic/src/helpers_128bit.rs @@ -24,7 +24,6 @@ use crate::biguint; use num_traits::Zero; use sp_std::{ cmp::{max, min}, - convert::TryInto, mem, }; diff --git a/substrate/primitives/arithmetic/src/lib.rs b/substrate/primitives/arithmetic/src/lib.rs index 273608a3d17117adc0e630654d7928100b784559..729da123757c7d7141a4b9d0e2c1a9c678225c03 100644 --- a/substrate/primitives/arithmetic/src/lib.rs +++ b/substrate/primitives/arithmetic/src/lib.rs @@ -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. diff --git a/substrate/primitives/arithmetic/src/per_things.rs b/substrate/primitives/arithmetic/src/per_things.rs index c3ccca56ca33f0702d3ece08b979103bd6e83bd1..1b9e6d91a2cd3d7df46a337c3f600a4ba4be3a1b 100644 --- a/substrate/primitives/arithmetic/src/per_things.rs +++ b/substrate/primitives/arithmetic/src/per_things.rs @@ -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::*, diff --git a/substrate/primitives/arithmetic/src/traits.rs b/substrate/primitives/arithmetic/src/traits.rs index 447f8cef51f9a86b7b23ea0aa3a3f32ce3860a2d..748aaed2a7cf555815da11890999d68ec6be6735 100644 --- a/substrate/primitives/arithmetic/src/traits.rs +++ b/substrate/primitives/arithmetic/src/traits.rs @@ -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. diff --git a/substrate/primitives/consensus/common/src/error.rs b/substrate/primitives/consensus/common/src/error.rs index 280ff2322898d98dae13f70c7185abb9fe64471d..0656b5761fb381861a0fbd5a7f09c813038747b8 100644 --- a/substrate/primitives/consensus/common/src/error.rs +++ b/substrate/primitives/consensus/common/src/error.rs @@ -86,13 +86,13 @@ pub enum Error { CannotSign(Vec<u8>, String), } -impl core::convert::From<Public> for Error { +impl From<Public> for Error { fn from(p: Public) -> Self { Self::InvalidAuthority(p) } } -impl core::convert::From<String> for Error { +impl From<String> for Error { fn from(s: String) -> Self { Self::StateUnavailable(s) } diff --git a/substrate/primitives/consensus/vrf/src/schnorrkel.rs b/substrate/primitives/consensus/vrf/src/schnorrkel.rs index 1ef23427e0ed036cc147d4172ab2b5525fd8186a..094a398893ff685d507f8f1515bcc87a053df439 100644 --- a/substrate/primitives/consensus/vrf/src/schnorrkel.rs +++ b/substrate/primitives/consensus/vrf/src/schnorrkel.rs @@ -21,7 +21,6 @@ use codec::{Decode, Encode, EncodeLike}; use schnorrkel::errors::MultiSignatureStage; use sp_core::U512; use sp_std::{ - convert::TryFrom, ops::{Deref, DerefMut}, prelude::*, }; diff --git a/substrate/primitives/core/src/crypto.rs b/substrate/primitives/core/src/crypto.rs index 12f8397eee4a4ecbb4b4d01e5afe294192584e97..f994da1515350df52070db2c7baf12eb32b14fc8 100644 --- a/substrate/primitives/core/src/crypto.rs +++ b/substrate/primitives/core/src/crypto.rs @@ -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 { diff --git a/substrate/primitives/core/src/ecdsa.rs b/substrate/primitives/core/src/ecdsa.rs index 7a4e4399913dc3d3af695ef2bb2c1c0ae077ebab..6343e3f4dfd0d3ff583e97af1c9e3603fc7e1251 100644 --- a/substrate/primitives/core/src/ecdsa.rs +++ b/substrate/primitives/core/src/ecdsa.rs @@ -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> { diff --git a/substrate/primitives/core/src/ed25519.rs b/substrate/primitives/core/src/ed25519.rs index 555c23c6b60cc89b5233285138971ebf130fe18d..0bde9e2e5303a93b978704c3224ffd720522c226 100644 --- a/substrate/primitives/core/src/ed25519.rs +++ b/substrate/primitives/core/src/ed25519.rs @@ -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> { diff --git a/substrate/primitives/core/src/offchain/mod.rs b/substrate/primitives/core/src/offchain/mod.rs index b9e310dc1fb10dacd7bd7089a4106668f8e6f14b..4ffadc3e4031d9fa236672d8f558910be8976d2d 100644 --- a/substrate/primitives/core/src/offchain/mod.rs +++ b/substrate/primitives/core/src/offchain/mod.rs @@ -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; diff --git a/substrate/primitives/core/src/sr25519.rs b/substrate/primitives/core/src/sr25519.rs index 2f298fa2a26661a72a6c2830766015362c4fabea..ef033c2099b5f069b1c6b9def3e88539fcd05ecf 100644 --- a/substrate/primitives/core/src/sr25519.rs +++ b/substrate/primitives/core/src/sr25519.rs @@ -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> { diff --git a/substrate/primitives/rpc/src/number.rs b/substrate/primitives/rpc/src/number.rs index 5a433a9598e01845bdf54ffa5059c36ccaddc86b..81084a09d4ac82fad0e77d7b4173136073d142de 100644 --- a/substrate/primitives/rpc/src/number.rs +++ b/substrate/primitives/rpc/src/number.rs @@ -20,10 +20,7 @@ use serde::{Deserialize, Serialize}; use sp_core::U256; -use std::{ - convert::{TryFrom, TryInto}, - fmt::Debug, -}; +use std::fmt::Debug; /// A number type that can be serialized both as a number or a string that encodes a number in a /// string. diff --git a/substrate/primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs b/substrate/primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs index 1fd22c6a25383867b7d2bc6ece461edf20c36a0c..7c3f066f6c83b4e31db2e61fd1ef343502cf3c65 100644 --- a/substrate/primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs +++ b/substrate/primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs @@ -51,7 +51,7 @@ pub fn derive_impl(input: DeriveInput) -> Result<TokenStream> { type PassBy = #crate_::pass_by::Enum<#ident>; } - impl #crate_::sp_std::convert::TryFrom<u8> for #ident { + impl TryFrom<u8> for #ident { type Error = (); fn try_from(inner: u8) -> #crate_::sp_std::result::Result<Self, ()> { diff --git a/substrate/primitives/runtime-interface/src/pass_by.rs b/substrate/primitives/runtime-interface/src/pass_by.rs index fb2d6b818d1749644a02dcb0e7a8061d0f5e0d1f..5d895ff5b3f82d8a84503aa66060d3da7ffad876 100644 --- a/substrate/primitives/runtime-interface/src/pass_by.rs +++ b/substrate/primitives/runtime-interface/src/pass_by.rs @@ -33,7 +33,7 @@ use crate::wasm::*; #[cfg(feature = "std")] use sp_wasm_interface::{FunctionContext, Pointer, Result}; -use sp_std::{convert::TryFrom, marker::PhantomData}; +use sp_std::marker::PhantomData; #[cfg(not(feature = "std"))] use sp_std::vec::Vec; @@ -382,7 +382,7 @@ impl<T: PassByInner<Inner = I>, I: RIType> RIType for Inner<T, I> { /// } /// } /// -/// impl std::convert::TryFrom<u8> for Test { +/// impl TryFrom<u8> for Test { /// type Error = (); /// /// fn try_from(val: u8) -> Result<Test, ()> { diff --git a/substrate/primitives/runtime-interface/test-wasm/src/lib.rs b/substrate/primitives/runtime-interface/test-wasm/src/lib.rs index 0c8a9c04ab1e9fb349a2302d62c04970e567bbea..f518a2e17498cad2c158aadf7debbc171b8baffe 100644 --- a/substrate/primitives/runtime-interface/test-wasm/src/lib.rs +++ b/substrate/primitives/runtime-interface/test-wasm/src/lib.rs @@ -22,7 +22,7 @@ use sp_runtime_interface::runtime_interface; #[cfg(not(feature = "std"))] -use sp_std::{convert::TryFrom, mem, prelude::*}; +use sp_std::{mem, prelude::*}; use sp_core::{sr25519::Public, wasm_export_functions}; diff --git a/substrate/primitives/runtime/src/curve.rs b/substrate/primitives/runtime/src/curve.rs index b5532c3d8cef7eddceb19bd7b9a4571f639dcae5..c6bfa660178701cee972a286338f17478790053d 100644 --- a/substrate/primitives/runtime/src/curve.rs +++ b/substrate/primitives/runtime/src/curve.rs @@ -110,8 +110,6 @@ where #[test] fn test_multiply_by_rational_saturating() { - use std::convert::TryInto; - let div = 100u32; for value in 0..=div { for p in 0..=div { @@ -132,8 +130,6 @@ fn test_multiply_by_rational_saturating() { #[test] fn test_calculate_for_fraction_times_denominator() { - use std::convert::TryInto; - let curve = PiecewiseLinear { points: &[ (Perbill::from_parts(0_000_000_000), Perbill::from_parts(0_500_000_000)), diff --git a/substrate/primitives/runtime/src/generic/header.rs b/substrate/primitives/runtime/src/generic/header.rs index 3e1a673d257a1fa3df2764d136abbec7b4cd73d9..a7b43608f2b78ca3ddf7a9afd8568a2a88491590 100644 --- a/substrate/primitives/runtime/src/generic/header.rs +++ b/substrate/primitives/runtime/src/generic/header.rs @@ -29,7 +29,7 @@ use crate::{ #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_core::U256; -use sp_std::{convert::TryFrom, fmt::Debug}; +use sp_std::fmt::Debug; /// Abstraction over a block header for a substrate chain. #[derive(Encode, Decode, PartialEq, Eq, Clone, sp_core::RuntimeDebug, TypeInfo)] diff --git a/substrate/primitives/runtime/src/lib.rs b/substrate/primitives/runtime/src/lib.rs index c09db5124cc1f136c39e0f700bd264efaba50e1a..39e606eb9b5f45fe5b118df1c12d7ccba57f7990 100644 --- a/substrate/primitives/runtime/src/lib.rs +++ b/substrate/primitives/runtime/src/lib.rs @@ -50,7 +50,7 @@ use sp_core::{ hash::{H256, H512}, sr25519, }; -use sp_std::{convert::TryFrom, prelude::*}; +use sp_std::prelude::*; use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; diff --git a/substrate/primitives/runtime/src/traits.rs b/substrate/primitives/runtime/src/traits.rs index ba4ca790a91982396a7d3dd17c597e9d2e2d38ff..9c71b2023d3f8a53b5ed9e36335e0dd9a99f65a1 100644 --- a/substrate/primitives/runtime/src/traits.rs +++ b/substrate/primitives/runtime/src/traits.rs @@ -37,13 +37,7 @@ pub use sp_arithmetic::traits::{ UniqueSaturatedFrom, UniqueSaturatedInto, Zero, }; use sp_core::{self, storage::StateVersion, Hasher, RuntimeDebug, TypeId}; -use sp_std::{ - self, - convert::{TryFrom, TryInto}, - fmt::Debug, - marker::PhantomData, - prelude::*, -}; +use sp_std::{self, fmt::Debug, marker::PhantomData, prelude::*}; #[cfg(feature = "std")] use std::fmt::Display; #[cfg(feature = "std")] diff --git a/substrate/primitives/std/src/lib.rs b/substrate/primitives/std/src/lib.rs index 05dff0f3077b66a2cf508bad279fc60cb352d521..6653c3d7eadecb257104289e27571ac3b7a24e3c 100644 --- a/substrate/primitives/std/src/lib.rs +++ b/substrate/primitives/std/src/lib.rs @@ -103,7 +103,6 @@ pub mod prelude { boxed::Box, clone::Clone, cmp::{Eq, PartialEq, Reverse}, - convert::{TryFrom, TryInto}, iter::IntoIterator, vec::Vec, }; diff --git a/substrate/primitives/storage/src/lib.rs b/substrate/primitives/storage/src/lib.rs index d377ea931df2df18a5f4b130b7d855dc64b0423b..fecd2b24dbb00f4120b837f1cfb1edbae1b34b84 100644 --- a/substrate/primitives/storage/src/lib.rs +++ b/substrate/primitives/storage/src/lib.rs @@ -423,7 +423,7 @@ impl From<StateVersion> for u8 { } } -impl sp_std::convert::TryFrom<u8> for StateVersion { +impl TryFrom<u8> for StateVersion { type Error = (); fn try_from(val: u8) -> sp_std::result::Result<StateVersion, ()> { match val { diff --git a/substrate/primitives/wasm-interface/src/lib.rs b/substrate/primitives/wasm-interface/src/lib.rs index d57666f126899ad49b42294f38b8b9022c480569..6dfc3116ddc4898ecc2598f3c39812a22719f309 100644 --- a/substrate/primitives/wasm-interface/src/lib.rs +++ b/substrate/primitives/wasm-interface/src/lib.rs @@ -73,7 +73,7 @@ impl From<ValueType> for u8 { } } -impl sp_std::convert::TryFrom<u8> for ValueType { +impl TryFrom<u8> for ValueType { type Error = (); fn try_from(val: u8) -> sp_std::result::Result<ValueType, ()> { diff --git a/substrate/utils/prometheus/src/lib.rs b/substrate/utils/prometheus/src/lib.rs index 1892741eff5da91fc81deeb0f30a0af31eea6cb1..3ea9d45d48b11a73c410076b317ca0a5ee71a814 100644 --- a/substrate/utils/prometheus/src/lib.rs +++ b/substrate/utils/prometheus/src/lib.rs @@ -122,7 +122,6 @@ async fn init_prometheus_with_listener( mod tests { use super::*; use hyper::{Client, Uri}; - use std::convert::TryFrom; #[test] fn prometheus_works() {