diff --git a/substrate/Cargo.toml b/substrate/Cargo.toml index 1ba46daebd..6f3c24be2b 100644 --- a/substrate/Cargo.toml +++ b/substrate/Cargo.toml @@ -123,7 +123,7 @@ members = [ "primitives/runtime", "primitives/sr-sandbox", "primitives/sr-staking-primitives", - "primitives/sr-std", + "primitives/std", "primitives/sr-version", "primitives/state-machine", "primitives/timestamp", diff --git a/substrate/bin/node-template/runtime/Cargo.toml b/substrate/bin/node-template/runtime/Cargo.toml index de1fbd6ed3..3c55cd68fb 100644 --- a/substrate/bin/node-template/runtime/Cargo.toml +++ b/substrate/bin/node-template/runtime/Cargo.toml @@ -17,7 +17,7 @@ inherents = { package = "sp-inherents", path = "../../../primitives/inherents", offchain-primitives = { package = "sp-offchain", path = "../../../primitives/offchain", default-features = false } primitives = { package = "sp-core", path = "../../../primitives/core", default-features = false } randomness-collective-flip = { package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip", default-features = false } -rstd = { package = "sp-std", path = "../../../primitives/sr-std", default-features = false } +sp-std = { path = "../../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../../primitives/sr-io", default-features = false } safe-mix = { version = "1.0.0", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } @@ -50,7 +50,7 @@ std = [ "offchain-primitives/std", "primitives/std", "randomness-collective-flip/std", - "rstd/std", + "sp-std/std", "runtime-io/std", "safe-mix/std", "serde", diff --git a/substrate/bin/node-template/runtime/src/lib.rs b/substrate/bin/node-template/runtime/src/lib.rs index dbb30d3107..7abe43c066 100644 --- a/substrate/bin/node-template/runtime/src/lib.rs +++ b/substrate/bin/node-template/runtime/src/lib.rs @@ -8,7 +8,7 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -use rstd::prelude::*; +use sp_std::prelude::*; use primitives::OpaqueMetadata; use sp_runtime::{ ApplyExtrinsicResult, transaction_validity::TransactionValidity, generic, create_runtime_str, diff --git a/substrate/bin/node/runtime/Cargo.toml b/substrate/bin/node/runtime/Cargo.toml index 662716c822..5a95961bec 100644 --- a/substrate/bin/node/runtime/Cargo.toml +++ b/substrate/bin/node/runtime/Cargo.toml @@ -21,7 +21,7 @@ inherents = { package = "sp-inherents", path = "../../../primitives/inherents", node-primitives = { path = "../primitives", default-features = false } offchain-primitives = { package = "sp-offchain", path = "../../../primitives/offchain", default-features = false } primitives = { package = "sp-core", path = "../../../primitives/core", default-features = false } -rstd = { package = "sp-std", path = "../../../primitives/sr-std", default-features = false } +sp-std = { path = "../../../primitives/std", default-features = false } sp-api = { path = "../../../primitives/sr-api", default-features = false } sp-runtime = { path = "../../../primitives/runtime", default-features = false } sp-staking = { path = "../../../primitives/sr-staking-primitives", default-features = false } @@ -97,7 +97,7 @@ std = [ "offences/std", "primitives/std", "randomness-collective-flip/std", - "rstd/std", + "sp-std/std", "rustc-hex", "safe-mix/std", "serde", diff --git a/substrate/bin/node/runtime/src/impls.rs b/substrate/bin/node/runtime/src/impls.rs index a4547aa07b..aa6e0554be 100644 --- a/substrate/bin/node/runtime/src/impls.rs +++ b/substrate/bin/node/runtime/src/impls.rs @@ -47,7 +47,7 @@ impl Convert for CurrencyToVoteHandler { /// Convert from weight to balance via a simple coefficient multiplication /// The associated type C encapsulates a constant in units of balance per weight -pub struct LinearWeightToFee(rstd::marker::PhantomData); +pub struct LinearWeightToFee(sp_std::marker::PhantomData); impl> Convert for LinearWeightToFee { fn convert(w: Weight) -> Balance { @@ -66,7 +66,7 @@ impl> Convert for LinearWeightToFee { /// /// Where `target_weight` must be given as the `Get` implementation of the `T` generic type. /// https://research.web3.foundation/en/latest/polkadot/Token%20Economics/#relay-chain-transaction-fees -pub struct TargetedFeeAdjustment(rstd::marker::PhantomData); +pub struct TargetedFeeAdjustment(sp_std::marker::PhantomData); impl> Convert for TargetedFeeAdjustment { fn convert(multiplier: Fixed64) -> Fixed64 { diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 614e31e721..e78e873142 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -20,7 +20,7 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit="256"] -use rstd::prelude::*; +use sp_std::prelude::*; use support::{ construct_runtime, parameter_types, weights::Weight, diff --git a/substrate/client/Cargo.toml b/substrate/client/Cargo.toml index 819ef2e74b..b62a004416 100644 --- a/substrate/client/Cargo.toml +++ b/substrate/client/Cargo.toml @@ -22,7 +22,7 @@ kvdb = "0.1.1" log = { version = "0.4.8" } parking_lot = { version = "0.9.0" } primitives = { package = "sp-core", path = "../primitives/core" } -rstd = { package = "sp-std", path = "../primitives/sr-std" } +sp-std = { path = "../primitives/std" } runtime-version = { package = "sp-version", path = "../primitives/sr-version" } sp-api = { path = "../primitives/sr-api" } sp-runtime = { path = "../primitives/runtime" } diff --git a/substrate/client/api/Cargo.toml b/substrate/client/api/Cargo.toml index 494763363a..9b524f2be0 100644 --- a/substrate/client/api/Cargo.toml +++ b/substrate/client/api/Cargo.toml @@ -22,7 +22,7 @@ kvdb = "0.1.1" log = { version = "0.4.8" } parking_lot = { version = "0.9.0" } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-version = { package = "sp-version", path = "../../primitives/sr-version", default-features = false } sp-api = { path = "../../primitives/sr-api" } sp-runtime = { path = "../../primitives/runtime", default-features = false } diff --git a/substrate/client/executor/runtime-test/Cargo.toml b/substrate/client/executor/runtime-test/Cargo.toml index 6ae8967837..75b9d510bd 100644 --- a/substrate/client/executor/runtime-test/Cargo.toml +++ b/substrate/client/executor/runtime-test/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" build = "build.rs" [dependencies] -rstd = { package = "sp-std", path = "../../../primitives/sr-std", default-features = false } +sp-std = { path = "../../../primitives/std", default-features = false } runtime_io = { package = "sp-io", path = "../../../primitives/sr-io", default-features = false } sandbox = { package = "sp-sandbox", path = "../../../primitives/sr-sandbox", default-features = false } primitives = { package = "sp-core", path = "../../../primitives/core", default-features = false } @@ -17,4 +17,4 @@ wasm-builder-runner = { package = "substrate-wasm-builder-runner", path = "../.. [features] default = [ "std" ] -std = ["runtime_io/std", "sandbox/std", "rstd/std"] +std = ["runtime_io/std", "sandbox/std", "sp-std/std"] diff --git a/substrate/client/executor/runtime-test/src/lib.rs b/substrate/client/executor/runtime-test/src/lib.rs index 15b515d6c4..7229d9b1a4 100644 --- a/substrate/client/executor/runtime-test/src/lib.rs +++ b/substrate/client/executor/runtime-test/src/lib.rs @@ -6,7 +6,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); #[cfg(not(feature = "std"))] -use rstd::{vec::Vec, vec}; +use sp_std::{vec::Vec, vec}; #[cfg(not(feature = "std"))] use runtime_io::{ diff --git a/substrate/frame/assets/Cargo.toml b/substrate/frame/assets/Cargo.toml index bbb9c30daa..85c3623cfe 100644 --- a/substrate/frame/assets/Cargo.toml +++ b/substrate/frame/assets/Cargo.toml @@ -16,7 +16,7 @@ system = { package = "frame-system", path = "../system", default-features = fals [dev-dependencies] primitives = { package = "sp-core", path = "../../primitives/core" } -rstd = { package = "sp-std", path = "../../primitives/sr-std" } +sp-std = { path = "../../primitives/std" } runtime-io = { package = "sp-io", path = "../../primitives/sr-io" } [features] diff --git a/substrate/frame/aura/Cargo.toml b/substrate/frame/aura/Cargo.toml index e9f3e85f34..88194574f2 100644 --- a/substrate/frame/aura/Cargo.toml +++ b/substrate/frame/aura/Cargo.toml @@ -9,7 +9,7 @@ app-crypto = { package = "sc-application-crypto", path = "../../primitives/appl codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } inherents = { package = "sp-inherents", path = "../../primitives/inherents", default-features = false } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } serde = { version = "1.0.101", optional = true } session = { package = "pallet-session", path = "../session", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } @@ -33,7 +33,7 @@ std = [ "inherents/std", "runtime-io/std", "primitives/std", - "rstd/std", + "sp-std/std", "serde", "sp-runtime/std", "support/std", diff --git a/substrate/frame/aura/src/lib.rs b/substrate/frame/aura/src/lib.rs index 59fe2dbd21..3e691e14cb 100644 --- a/substrate/frame/aura/src/lib.rs +++ b/substrate/frame/aura/src/lib.rs @@ -47,7 +47,7 @@ use pallet_timestamp; -use rstd::{result, prelude::*}; +use sp_std::{result, prelude::*}; use codec::{Encode, Decode}; use support::{ decl_storage, decl_module, Parameter, traits::{Get, FindAuthor}, diff --git a/substrate/frame/authority-discovery/Cargo.toml b/substrate/frame/authority-discovery/Cargo.toml index e3db707a6a..40fb6122f5 100644 --- a/substrate/frame/authority-discovery/Cargo.toml +++ b/substrate/frame/authority-discovery/Cargo.toml @@ -9,7 +9,7 @@ authority-discovery-primitives = { package = "sp-authority-discovery", path = ". app-crypto = { package = "sc-application-crypto", path = "../../primitives/application-crypto", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } serde = { version = "1.0.101", optional = true } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } session = { package = "pallet-session", path = "../session", default-features = false, features = ["historical" ] } @@ -27,7 +27,7 @@ std = [ "authority-discovery-primitives/std", "codec/std", "primitives/std", - "rstd/std", + "sp-std/std", "runtime-io/std", "serde", "session/std", diff --git a/substrate/frame/authority-discovery/src/lib.rs b/substrate/frame/authority-discovery/src/lib.rs index b24fe5e0eb..92dcb2277d 100644 --- a/substrate/frame/authority-discovery/src/lib.rs +++ b/substrate/frame/authority-discovery/src/lib.rs @@ -22,7 +22,7 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use sp_std::prelude::*; use support::{decl_module, decl_storage}; use authority_discovery_primitives::AuthorityId; diff --git a/substrate/frame/authorship/Cargo.toml b/substrate/frame/authorship/Cargo.toml index 496c4a1122..65b299dc29 100644 --- a/substrate/frame/authorship/Cargo.toml +++ b/substrate/frame/authorship/Cargo.toml @@ -10,7 +10,7 @@ primitives = { package = "sp-core", path = "../../primitives/core", default-fea codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } inherents = { package = "sp-inherents", path = "../../primitives/inherents", default-features = false } sp-authorship = { path = "../../primitives/authorship", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } @@ -24,7 +24,7 @@ std = [ "primitives/std", "inherents/std", "sp-runtime/std", - "rstd/std", + "sp-std/std", "support/std", "system/std", "runtime-io/std", diff --git a/substrate/frame/authorship/src/lib.rs b/substrate/frame/authorship/src/lib.rs index 73a38b0ead..edb01b7d2a 100644 --- a/substrate/frame/authorship/src/lib.rs +++ b/substrate/frame/authorship/src/lib.rs @@ -20,8 +20,8 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::{result, prelude::*}; -use rstd::collections::btree_set::BTreeSet; +use sp_std::{result, prelude::*}; +use sp_std::collections::btree_set::BTreeSet; use support::{decl_module, decl_storage, ensure}; use support::traits::{FindAuthor, VerifySeal, Get}; use support::dispatch::Result as DispatchResult; @@ -98,7 +98,7 @@ impl FilterUncle for () { /// A filter on uncles which verifies seals and does no additional checks. /// This is well-suited to consensus modes such as PoW where the cost of /// equivocating is high. -pub struct SealVerify(rstd::marker::PhantomData); +pub struct SealVerify(sp_std::marker::PhantomData); impl> FilterUncle for SealVerify @@ -116,7 +116,7 @@ impl> FilterUncle /// one uncle included per author per height. /// /// This does O(n log n) work in the number of uncles included. -pub struct OnePerAuthorPerHeight(rstd::marker::PhantomData<(T, N)>); +pub struct OnePerAuthorPerHeight(sp_std::marker::PhantomData<(T, N)>); impl FilterUncle for OnePerAuthorPerHeight diff --git a/substrate/frame/babe/Cargo.toml b/substrate/frame/babe/Cargo.toml index a81865860d..8124ba6a59 100644 --- a/substrate/frame/babe/Cargo.toml +++ b/substrate/frame/babe/Cargo.toml @@ -9,7 +9,7 @@ hex-literal = "0.2.1" codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } inherents = { package = "sp-inherents", path = "../../primitives/inherents", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } sp-staking = { path = "../../primitives/sr-staking-primitives", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -32,7 +32,7 @@ default = ["std"] std = [ "serde", "codec/std", - "rstd/std", + "sp-std/std", "support/std", "sp-runtime/std", "sp-staking/std", diff --git a/substrate/frame/babe/src/lib.rs b/substrate/frame/babe/src/lib.rs index 73a7adaaa3..a5db17e3bd 100644 --- a/substrate/frame/babe/src/lib.rs +++ b/substrate/frame/babe/src/lib.rs @@ -23,7 +23,7 @@ pub use timestamp; use sp_timestamp; -use rstd::{result, prelude::*}; +use sp_std::{result, prelude::*}; use support::{decl_storage, decl_module, traits::FindAuthor, traits::Get}; use sp_timestamp::OnTimestampSet; use sp_runtime::{generic::DigestItem, ConsensusEngineId, Perbill}; @@ -445,7 +445,7 @@ impl Module { /// randomness. Returns the new randomness. fn randomness_change_epoch(next_epoch_index: u64) -> [u8; RANDOMNESS_LENGTH] { let this_randomness = NextRandomness::get(); - let segment_idx: u32 = ::mutate(|s| rstd::mem::replace(s, 0)); + let segment_idx: u32 = ::mutate(|s| sp_std::mem::replace(s, 0)); // overestimate to the segment being full. let rho_size = segment_idx.saturating_add(1) as usize * UNDER_CONSTRUCTION_SEGMENT_LENGTH; diff --git a/substrate/frame/balances/Cargo.toml b/substrate/frame/balances/Cargo.toml index f0dd86a444..f4c6d9f5a1 100644 --- a/substrate/frame/balances/Cargo.toml +++ b/substrate/frame/balances/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" serde = { version = "1.0.101", optional = true } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } @@ -24,7 +24,7 @@ std = [ "serde", "safe-mix/std", "codec/std", - "rstd/std", + "sp-std/std", "support/std", "sp-runtime/std", "system/std", diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index 6a3e701ac0..96737c64db 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -159,8 +159,8 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; -use rstd::{cmp, result, mem, fmt::Debug}; +use sp_std::prelude::*; +use sp_std::{cmp, result, mem, fmt::Debug}; use codec::{Codec, Encode, Decode}; use support::{ StorageValue, Parameter, decl_event, decl_storage, decl_module, @@ -614,7 +614,7 @@ mod imbalances { result, Subtrait, DefaultInstance, Imbalance, Trait, Zero, Instance, Saturating, StorageValue, TryDrop, }; - use rstd::mem; + use sp_std::mem; /// Opaque, move-only struct with private fields that serves as a token denoting that /// funds have been created without any equal and opposite accounting. diff --git a/substrate/frame/collective/Cargo.toml b/substrate/frame/collective/Cargo.toml index c7baa61346..8472a13186 100644 --- a/substrate/frame/collective/Cargo.toml +++ b/substrate/frame/collective/Cargo.toml @@ -9,7 +9,7 @@ serde = { version = "1.0.101", optional = true } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -25,7 +25,7 @@ std = [ "safe-mix/std", "codec/std", "primitives/std", - "rstd/std", + "sp-std/std", "serde", "runtime-io/std", "support/std", diff --git a/substrate/frame/collective/src/lib.rs b/substrate/frame/collective/src/lib.rs index 6ecaf3045f..176967636d 100644 --- a/substrate/frame/collective/src/lib.rs +++ b/substrate/frame/collective/src/lib.rs @@ -23,7 +23,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit="128"] -use rstd::{prelude::*, result}; +use sp_std::{prelude::*, result}; use primitives::u32_trait::Value as U32; use sp_runtime::RuntimeDebug; use sp_runtime::traits::{Hash, EnsureOrigin}; @@ -63,7 +63,7 @@ pub enum RawOrigin { /// It has been condoned by a single member of the collective. Member(AccountId), /// Dummy to manage the fact we have instancing. - _Phantom(rstd::marker::PhantomData), + _Phantom(sp_std::marker::PhantomData), } /// Origin for the collective module. @@ -96,7 +96,7 @@ decl_storage! { pub Members get(fn members): Vec; } add_extra_genesis { - config(phantom): rstd::marker::PhantomData; + config(phantom): sp_std::marker::PhantomData; config(members): Vec; build(|config| Module::::initialize_members(&config.members)) } @@ -306,7 +306,7 @@ where } } -pub struct EnsureMember(rstd::marker::PhantomData<(AccountId, I)>); +pub struct EnsureMember(sp_std::marker::PhantomData<(AccountId, I)>); impl< O: Into, O>> + From>, AccountId, @@ -321,7 +321,7 @@ impl< } } -pub struct EnsureMembers(rstd::marker::PhantomData<(N, AccountId, I)>); +pub struct EnsureMembers(sp_std::marker::PhantomData<(N, AccountId, I)>); impl< O: Into, O>> + From>, N: U32, @@ -338,7 +338,7 @@ impl< } pub struct EnsureProportionMoreThan( - rstd::marker::PhantomData<(N, D, AccountId, I)> + sp_std::marker::PhantomData<(N, D, AccountId, I)> ); impl< O: Into, O>> + From>, @@ -357,7 +357,7 @@ impl< } pub struct EnsureProportionAtLeast( - rstd::marker::PhantomData<(N, D, AccountId, I)> + sp_std::marker::PhantomData<(N, D, AccountId, I)> ); impl< O: Into, O>> + From>, diff --git a/substrate/frame/contracts/Cargo.toml b/substrate/frame/contracts/Cargo.toml index b961fba232..f5c9ec5fdb 100644 --- a/substrate/frame/contracts/Cargo.toml +++ b/substrate/frame/contracts/Cargo.toml @@ -13,7 +13,7 @@ wasmi-validation = { version = "0.3.0", default-features = false } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sandbox = { package = "sp-sandbox", path = "../../primitives/sr-sandbox", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } @@ -34,7 +34,7 @@ std = [ "primitives/std", "sp-runtime/std", "runtime-io/std", - "rstd/std", + "sp-std/std", "sandbox/std", "support/std", "system/std", diff --git a/substrate/frame/contracts/rpc/runtime-api/Cargo.toml b/substrate/frame/contracts/rpc/runtime-api/Cargo.toml index b0e84c7a28..ab127a7361 100644 --- a/substrate/frame/contracts/rpc/runtime-api/Cargo.toml +++ b/substrate/frame/contracts/rpc/runtime-api/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] sp-api = { path = "../../../../primitives/sr-api", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../../../primitives/sr-std", default-features = false } +sp-std = { path = "../../../../primitives/std", default-features = false } sp-runtime = { path = "../../../../primitives/runtime", default-features = false } [features] @@ -15,6 +15,6 @@ default = ["std"] std = [ "sp-api/std", "codec/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", ] diff --git a/substrate/frame/contracts/rpc/runtime-api/src/lib.rs b/substrate/frame/contracts/rpc/runtime-api/src/lib.rs index a4ee568c98..73e937cf6c 100644 --- a/substrate/frame/contracts/rpc/runtime-api/src/lib.rs +++ b/substrate/frame/contracts/rpc/runtime-api/src/lib.rs @@ -22,7 +22,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::vec::Vec; +use sp_std::vec::Vec; use codec::{Encode, Decode, Codec}; use sp_runtime::RuntimeDebug; diff --git a/substrate/frame/contracts/src/account_db.rs b/substrate/frame/contracts/src/account_db.rs index 77732db871..962dadff2a 100644 --- a/substrate/frame/contracts/src/account_db.rs +++ b/substrate/frame/contracts/src/account_db.rs @@ -21,9 +21,9 @@ use super::{ TrieIdGenerator, }; use crate::exec::StorageKey; -use rstd::cell::RefCell; -use rstd::collections::btree_map::{BTreeMap, Entry}; -use rstd::prelude::*; +use sp_std::cell::RefCell; +use sp_std::collections::btree_map::{BTreeMap, Entry}; +use sp_std::prelude::*; use runtime_io::hashing::blake2_256; use sp_runtime::traits::{Bounded, Zero}; use support::traits::{Currency, Get, Imbalance, SignedImbalance, UpdateBalanceOutcome}; diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 12f71251e2..9243d9f8c1 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -20,7 +20,7 @@ use crate::account_db::{AccountDb, DirectAccountDb, OverlayAccountDb}; use crate::gas::{Gas, GasMeter, Token, approx_gas_for_balance}; use crate::rent; -use rstd::prelude::*; +use sp_std::prelude::*; use sp_runtime::traits::{Bounded, CheckedAdd, CheckedSub, Zero}; use support::{ storage::unhashed, diff --git a/substrate/frame/contracts/src/gas.rs b/substrate/frame/contracts/src/gas.rs index b791a4681b..b9faaf298f 100644 --- a/substrate/frame/contracts/src/gas.rs +++ b/substrate/frame/contracts/src/gas.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . use crate::{GasSpent, Module, Trait, BalanceOf, NegativeImbalanceOf}; -use rstd::convert::TryFrom; +use sp_std::convert::TryFrom; use sp_runtime::traits::{ CheckedMul, Zero, SaturatedConversion, SimpleArithmetic, UniqueSaturatedInto, }; diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 166ee467b1..e288fba2cc 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -109,7 +109,7 @@ pub use crate::exec::{ExecResult, ExecReturnValue, ExecError, StatusCode}; #[cfg(feature = "std")] use serde::{Serialize, Deserialize}; use primitives::crypto::UncheckedFrom; -use rstd::{prelude::*, marker::PhantomData, fmt::Debug}; +use sp_std::{prelude::*, marker::PhantomData, fmt::Debug}; use codec::{Codec, Encode, Decode}; use runtime_io::hashing::blake2_256; use sp_runtime::{ @@ -233,7 +233,7 @@ impl RawTombstoneContractInfo where H: Member + MaybeSerializeDeserialize+ Debug + AsRef<[u8]> + AsMut<[u8]> + Copy + Default - + rstd::hash::Hash + Codec, + + sp_std::hash::Hash + Codec, Hasher: Hash, { fn new(storage_root: &[u8], code_hash: H) -> Self { @@ -680,7 +680,7 @@ impl Module { pub fn get_storage( address: T::AccountId, key: [u8; 32], - ) -> rstd::result::Result>, GetStorageError> { + ) -> sp_std::result::Result>, GetStorageError> { let contract_info = >::get(&address) .ok_or(GetStorageError::ContractDoesntExist)? .get_alive() @@ -1018,14 +1018,14 @@ impl Default for CheckBlockGasLimit { } } -impl rstd::fmt::Debug for CheckBlockGasLimit { +impl sp_std::fmt::Debug for CheckBlockGasLimit { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "CheckBlockGasLimit") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -1037,7 +1037,7 @@ impl SignedExtension for CheckBlockGasLimit { type DispatchInfo = DispatchInfo; type Pre = (); - fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) } + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } fn validate( &self, diff --git a/substrate/frame/contracts/src/wasm/code_cache.rs b/substrate/frame/contracts/src/wasm/code_cache.rs index 2c5bd492e2..7264122397 100644 --- a/substrate/frame/contracts/src/wasm/code_cache.rs +++ b/substrate/frame/contracts/src/wasm/code_cache.rs @@ -29,7 +29,7 @@ use crate::gas::{Gas, GasMeter, Token}; use crate::wasm::{prepare, runtime::Env, PrefabWasmModule}; use crate::{CodeHash, CodeStorage, PristineCode, Schedule, Trait}; -use rstd::prelude::*; +use sp_std::prelude::*; use sp_runtime::traits::{Hash, Bounded}; use support::StorageMap; diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index b1010d7b14..273b7fb037 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -22,7 +22,7 @@ use crate::wasm::env_def::FunctionImplProvider; use crate::exec::{Ext, ExecResult}; use crate::gas::GasMeter; -use rstd::prelude::*; +use sp_std::prelude::*; use codec::{Encode, Decode}; use sandbox; diff --git a/substrate/frame/contracts/src/wasm/prepare.rs b/substrate/frame/contracts/src/wasm/prepare.rs index 6a443d63e8..f9a40489d9 100644 --- a/substrate/frame/contracts/src/wasm/prepare.rs +++ b/substrate/frame/contracts/src/wasm/prepare.rs @@ -25,7 +25,7 @@ use crate::Schedule; use parity_wasm::elements::{self, Internal, External, MemoryType, Type, ValueType}; use pwasm_utils; use pwasm_utils::rules; -use rstd::prelude::*; +use sp_std::prelude::*; use sp_runtime::traits::{SaturatedConversion}; struct ContractModule<'a> { diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 2e69d17bc2..0204d4eba0 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -23,9 +23,9 @@ use crate::exec::{ use crate::gas::{Gas, GasMeter, Token, GasMeterResult, approx_gas_for_balance}; use sandbox; use system; -use rstd::prelude::*; -use rstd::convert::TryInto; -use rstd::mem; +use sp_std::prelude::*; +use sp_std::convert::TryInto; +use sp_std::mem; use codec::{Decode, Encode}; use sp_runtime::traits::{Bounded, SaturatedConversion}; diff --git a/substrate/frame/democracy/Cargo.toml b/substrate/frame/democracy/Cargo.toml index f3e23672af..62e4f60f8e 100644 --- a/substrate/frame/democracy/Cargo.toml +++ b/substrate/frame/democracy/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" serde = { version = "1.0.101", optional = true, features = ["derive"] } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -24,7 +24,7 @@ std = [ "serde", "safe-mix/std", "codec/std", - "rstd/std", + "sp-std/std", "runtime-io/std", "support/std", "sp-runtime/std", diff --git a/substrate/frame/democracy/src/lib.rs b/substrate/frame/democracy/src/lib.rs index 33fe6453fc..2bbef15d60 100644 --- a/substrate/frame/democracy/src/lib.rs +++ b/substrate/frame/democracy/src/lib.rs @@ -18,8 +18,8 @@ #![recursion_limit="128"] #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; -use rstd::{result, convert::TryFrom}; +use sp_std::prelude::*; +use sp_std::{result, convert::TryFrom}; use sp_runtime::{ RuntimeDebug, traits::{Zero, Bounded, CheckedMul, CheckedDiv, EnsureOrigin, Hash, Dispatchable, Saturating}, diff --git a/substrate/frame/democracy/src/vote_threshold.rs b/substrate/frame/democracy/src/vote_threshold.rs index 4262f7d7cf..d5e215fe32 100644 --- a/substrate/frame/democracy/src/vote_threshold.rs +++ b/substrate/frame/democracy/src/vote_threshold.rs @@ -20,7 +20,7 @@ use serde::{Serialize, Deserialize}; use codec::{Encode, Decode}; use sp_runtime::traits::{Zero, IntegerSquareRoot}; -use rstd::ops::{Add, Mul, Div, Rem}; +use sp_std::ops::{Add, Mul, Div, Rem}; /// A means of determining if a vote is past pass threshold. #[derive(Clone, Copy, PartialEq, Eq, Encode, Decode, sp_runtime::RuntimeDebug)] diff --git a/substrate/frame/elections-phragmen/Cargo.toml b/substrate/frame/elections-phragmen/Cargo.toml index b1fa40741a..979ed48ca2 100644 --- a/substrate/frame/elections-phragmen/Cargo.toml +++ b/substrate/frame/elections-phragmen/Cargo.toml @@ -10,7 +10,7 @@ sp-runtime = { path = "../../primitives/runtime", default-features = false } phragmen = { package = "sp-phragmen", path = "../../primitives/phragmen", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } [dev-dependencies] runtime_io = { package = "sp-io", path = "../../primitives/sr-io" } @@ -28,5 +28,5 @@ std = [ "sp-runtime/std", "phragmen/std", "system/std", - "rstd/std", + "sp-std/std", ] diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index df7a223610..e87a0e7275 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -82,7 +82,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use sp_std::prelude::*; use sp_runtime::{print, traits::{Zero, StaticLookup, Bounded, Convert}}; use support::{ decl_storage, decl_event, ensure, decl_module, dispatch, weights::SimpleDispatchInfo, diff --git a/substrate/frame/elections/Cargo.toml b/substrate/frame/elections/Cargo.toml index c27b447aeb..4077d98879 100644 --- a/substrate/frame/elections/Cargo.toml +++ b/substrate/frame/elections/Cargo.toml @@ -9,7 +9,7 @@ serde = { version = "1.0.101", optional = true } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -25,7 +25,7 @@ std = [ "safe-mix/std", "codec/std", "primitives/std", - "rstd/std", + "sp-std/std", "serde", "runtime-io/std", "support/std", diff --git a/substrate/frame/elections/src/lib.rs b/substrate/frame/elections/src/lib.rs index 1a289eb23f..530ffad963 100644 --- a/substrate/frame/elections/src/lib.rs +++ b/substrate/frame/elections/src/lib.rs @@ -23,7 +23,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit="128"] -use rstd::prelude::*; +use sp_std::prelude::*; use sp_runtime::{ RuntimeDebug, print, diff --git a/substrate/frame/evm/Cargo.toml b/substrate/frame/evm/Cargo.toml index 245d715665..b933c45382 100644 --- a/substrate/frame/evm/Cargo.toml +++ b/substrate/frame/evm/Cargo.toml @@ -13,7 +13,7 @@ timestamp = { package = "pallet-timestamp", path = "../timestamp", default-featu balances = { package = "pallet-balances", path = "../balances", default-features = false } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } primitive-types = { version = "0.6", default-features = false, features = ["rlp"] } rlp = { version = "0.4", default-features = false } @@ -31,7 +31,7 @@ std = [ "system/std", "balances/std", "runtime-io/std", - "rstd/std", + "sp-std/std", "sha3/std", "rlp/std", "primitive-types/std", diff --git a/substrate/frame/evm/src/backend.rs b/substrate/frame/evm/src/backend.rs index 18d8a01158..ab0ed43cc9 100644 --- a/substrate/frame/evm/src/backend.rs +++ b/substrate/frame/evm/src/backend.rs @@ -1,5 +1,5 @@ -use rstd::marker::PhantomData; -use rstd::vec::Vec; +use sp_std::marker::PhantomData; +use sp_std::vec::Vec; #[cfg(feature = "std")] use serde::{Serialize, Deserialize}; use codec::{Encode, Decode}; diff --git a/substrate/frame/evm/src/lib.rs b/substrate/frame/evm/src/lib.rs index c02739885e..8ad7fbc139 100644 --- a/substrate/frame/evm/src/lib.rs +++ b/substrate/frame/evm/src/lib.rs @@ -23,7 +23,7 @@ mod backend; pub use crate::backend::{Account, Log, Vicinity, Backend}; -use rstd::{vec::Vec, marker::PhantomData}; +use sp_std::{vec::Vec, marker::PhantomData}; use support::{dispatch::Result, decl_module, decl_storage, decl_event}; use support::weights::{Weight, WeighData, ClassifyDispatch, DispatchClass, PaysFee}; use support::traits::{Currency, WithdrawReason, ExistenceRequirement}; diff --git a/substrate/frame/example/Cargo.toml b/substrate/frame/example/Cargo.toml index ccddd2ce1a..9a6be32519 100644 --- a/substrate/frame/example/Cargo.toml +++ b/substrate/frame/example/Cargo.toml @@ -11,7 +11,7 @@ support = { package = "frame-support", path = "../support", default-features = f system = { package = "frame-system", path = "../system", default-features = false } balances = { package = "pallet-balances", path = "../balances", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } [dev-dependencies] @@ -27,5 +27,5 @@ std = [ "system/std", "balances/std", "runtime-io/std", - "rstd/std" + "sp-std/std" ] diff --git a/substrate/frame/example/src/lib.rs b/substrate/frame/example/src/lib.rs index 3e201f7a9b..f591b3c9d7 100644 --- a/substrate/frame/example/src/lib.rs +++ b/substrate/frame/example/src/lib.rs @@ -253,7 +253,7 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -use rstd::marker::PhantomData; +use sp_std::marker::PhantomData; use support::{ dispatch::Result, decl_module, decl_storage, decl_event, weights::{SimpleDispatchInfo, DispatchInfo, DispatchClass, ClassifyDispatch, WeighData, Weight, PaysFee}, @@ -596,8 +596,8 @@ impl Module { #[derive(Encode, Decode, Clone, Eq, PartialEq)] pub struct WatchDummy(PhantomData); -impl rstd::fmt::Debug for WatchDummy { - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { +impl sp_std::fmt::Debug for WatchDummy { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "WatchDummy") } } @@ -613,7 +613,7 @@ impl SignedExtension for WatchDummy { type DispatchInfo = DispatchInfo; type Pre = (); - fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) } + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } fn validate( &self, diff --git a/substrate/frame/executive/Cargo.toml b/substrate/frame/executive/Cargo.toml index e18d0fdb0b..0e2e748066 100644 --- a/substrate/frame/executive/Cargo.toml +++ b/substrate/frame/executive/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -23,7 +23,7 @@ transaction-payment = { package = "pallet-transaction-payment", path = "../trans [features] default = ["std"] std = [ - "rstd/std", + "sp-std/std", "support/std", "serde", "codec/std", diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index 9f42ac1a05..7c94c9c012 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -76,7 +76,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::{prelude::*, marker::PhantomData}; +use sp_std::{prelude::*, marker::PhantomData}; use support::weights::{GetDispatchInfo, WeighBlock, DispatchInfo}; use sp_runtime::{ generic::Digest, ApplyExtrinsicResult, diff --git a/substrate/frame/finality-tracker/Cargo.toml b/substrate/frame/finality-tracker/Cargo.toml index a9ead70d05..29e304e692 100644 --- a/substrate/frame/finality-tracker/Cargo.toml +++ b/substrate/frame/finality-tracker/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } inherents = { package = "sp-inherents", path = "../../primitives/inherents", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } sp-finality-tracker = { path = "../../primitives/finality-tracker", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -24,7 +24,7 @@ default = ["std"] std = [ "serde/std", "codec/std", - "rstd/std", + "sp-std/std", "support/std", "sp-runtime/std", "frame-system/std", diff --git a/substrate/frame/finality-tracker/src/lib.rs b/substrate/frame/finality-tracker/src/lib.rs index 3cb842de24..d15953d5ae 100644 --- a/substrate/frame/finality-tracker/src/lib.rs +++ b/substrate/frame/finality-tracker/src/lib.rs @@ -20,7 +20,7 @@ use inherents::{InherentIdentifier, ProvideInherent, InherentData, MakeFatalError}; use sp_runtime::traits::{One, Zero, SaturatedConversion}; -use rstd::{prelude::*, result, cmp, vec}; +use sp_std::{prelude::*, result, cmp, vec}; use support::{decl_module, decl_storage}; use support::traits::Get; use frame_system::{ensure_none, Trait as SystemTrait}; diff --git a/substrate/frame/generic-asset/Cargo.toml b/substrate/frame/generic-asset/Cargo.toml index 2889e66012..1cdbc47394 100644 --- a/substrate/frame/generic-asset/Cargo.toml +++ b/substrate/frame/generic-asset/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } @@ -21,7 +21,7 @@ default = ["std"] std =[ "serde/std", "codec/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", "support/std", "system/std", diff --git a/substrate/frame/generic-asset/src/lib.rs b/substrate/frame/generic-asset/src/lib.rs index 57942ae186..ba7cdae7df 100644 --- a/substrate/frame/generic-asset/src/lib.rs +++ b/substrate/frame/generic-asset/src/lib.rs @@ -159,8 +159,8 @@ use sp_runtime::traits::{ Zero, Bounded, }; -use rstd::prelude::*; -use rstd::{cmp, result, fmt::Debug}; +use sp_std::prelude::*; +use sp_std::{cmp, result, fmt::Debug}; use support::dispatch::Result; use support::{ decl_event, decl_module, decl_storage, ensure, @@ -625,7 +625,7 @@ impl Module { /// NOTE: This is different behavior than `reserve`. pub fn unreserve(asset_id: &T::AssetId, who: &T::AccountId, amount: T::Balance) -> T::Balance { let b = Self::reserved_balance(asset_id, who); - let actual = rstd::cmp::min(b, amount); + let actual = sp_std::cmp::min(b, amount); let original_free_balance = Self::free_balance(asset_id, who); let new_free_balance = original_free_balance + actual; Self::set_free_balance(asset_id, who, new_free_balance); @@ -642,7 +642,7 @@ impl Module { /// the caller will do this. fn slash(asset_id: &T::AssetId, who: &T::AccountId, amount: T::Balance) -> Option { let free_balance = Self::free_balance(asset_id, who); - let free_slash = rstd::cmp::min(free_balance, amount); + let free_slash = sp_std::cmp::min(free_balance, amount); let new_free_balance = free_balance - free_slash; Self::set_free_balance(asset_id, who, new_free_balance); if free_slash < amount { @@ -660,7 +660,7 @@ impl Module { /// the caller will do this. fn slash_reserved(asset_id: &T::AssetId, who: &T::AccountId, amount: T::Balance) -> Option { let original_reserve_balance = Self::reserved_balance(asset_id, who); - let slash = rstd::cmp::min(original_reserve_balance, amount); + let slash = sp_std::cmp::min(original_reserve_balance, amount); let new_reserve_balance = original_reserve_balance - slash; Self::set_reserved_balance(asset_id, who, new_reserve_balance); if amount == slash { @@ -684,7 +684,7 @@ impl Module { amount: T::Balance, ) -> T::Balance { let b = Self::reserved_balance(asset_id, who); - let slash = rstd::cmp::min(b, amount); + let slash = sp_std::cmp::min(b, amount); let original_free_balance = Self::free_balance(asset_id, beneficiary); let new_free_balance = original_free_balance + slash; @@ -866,14 +866,14 @@ mod imbalances { use super::{ result, AssetIdProvider, Imbalance, Saturating, StorageMap, Subtrait, Zero, TryDrop }; - use rstd::mem; + use sp_std::mem; /// Opaque, move-only struct with private fields that serves as a token denoting that /// funds have been created without any equal and opposite accounting. #[must_use] pub struct PositiveImbalance>( T::Balance, - rstd::marker::PhantomData, + sp_std::marker::PhantomData, ); impl PositiveImbalance where @@ -890,7 +890,7 @@ mod imbalances { #[must_use] pub struct NegativeImbalance>( T::Balance, - rstd::marker::PhantomData, + sp_std::marker::PhantomData, ); impl NegativeImbalance where @@ -1091,7 +1091,7 @@ impl Trait for ElevatedTrait { } #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] -pub struct AssetCurrency(rstd::marker::PhantomData, rstd::marker::PhantomData); +pub struct AssetCurrency(sp_std::marker::PhantomData, sp_std::marker::PhantomData); impl Currency for AssetCurrency where @@ -1264,7 +1264,7 @@ where } } -pub struct StakingAssetIdProvider(rstd::marker::PhantomData); +pub struct StakingAssetIdProvider(sp_std::marker::PhantomData); impl AssetIdProvider for StakingAssetIdProvider { type AssetId = T::AssetId; @@ -1273,7 +1273,7 @@ impl AssetIdProvider for StakingAssetIdProvider { } } -pub struct SpendingAssetIdProvider(rstd::marker::PhantomData); +pub struct SpendingAssetIdProvider(sp_std::marker::PhantomData); impl AssetIdProvider for SpendingAssetIdProvider { type AssetId = T::AssetId; diff --git a/substrate/frame/grandpa/Cargo.toml b/substrate/frame/grandpa/Cargo.toml index 0af02724f8..ebb1143e1f 100644 --- a/substrate/frame/grandpa/Cargo.toml +++ b/substrate/frame/grandpa/Cargo.toml @@ -9,7 +9,7 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } sp-finality-grandpa = { path = "../../primitives/finality-grandpa", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } sp-staking = { path = "../../primitives/sr-staking-primitives", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -27,7 +27,7 @@ std = [ "codec/std", "primitives/std", "sp-finality-grandpa/std", - "rstd/std", + "sp-std/std", "support/std", "sp-runtime/std", "sp-staking/std", diff --git a/substrate/frame/grandpa/src/lib.rs b/substrate/frame/grandpa/src/lib.rs index 12fb28546c..f80974a31a 100644 --- a/substrate/frame/grandpa/src/lib.rs +++ b/substrate/frame/grandpa/src/lib.rs @@ -30,7 +30,7 @@ // re-export since this is necessary for `impl_apis` in runtime. pub use sp_finality_grandpa as fg_primitives; -use rstd::prelude::*; +use sp_std::prelude::*; use codec::{self as codec, Encode, Decode, Error}; use support::{decl_event, decl_storage, decl_module, dispatch::Result, storage}; use sp_runtime::{ diff --git a/substrate/frame/identity/Cargo.toml b/substrate/frame/identity/Cargo.toml index 6b81433f0b..8fcc01b0c8 100644 --- a/substrate/frame/identity/Cargo.toml +++ b/substrate/frame/identity/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -23,7 +23,7 @@ default = ["std"] std = [ "serde", "codec/std", - "rstd/std", + "sp-std/std", "runtime-io/std", "sp-runtime/std", "support/std", diff --git a/substrate/frame/identity/src/lib.rs b/substrate/frame/identity/src/lib.rs index e51df5eed2..8422382057 100644 --- a/substrate/frame/identity/src/lib.rs +++ b/substrate/frame/identity/src/lib.rs @@ -65,8 +65,8 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; -use rstd::{fmt::Debug, ops::Add, iter::once}; +use sp_std::prelude::*; +use sp_std::{fmt::Debug, ops::Add, iter::once}; use enumflags2::BitFlags; use codec::{Encode, Decode}; use sp_runtime::{traits::{StaticLookup, EnsureOrigin, Zero}, RuntimeDebug}; @@ -134,7 +134,7 @@ pub enum Data { } impl Decode for Data { - fn decode(input: &mut I) -> rstd::result::Result { + fn decode(input: &mut I) -> sp_std::result::Result { let b = input.read_byte()?; Ok(match b { 0 => Data::None, @@ -256,7 +256,7 @@ impl Encode for IdentityFields { } } impl Decode for IdentityFields { - fn decode(input: &mut I) -> rstd::result::Result { + fn decode(input: &mut I) -> sp_std::result::Result { let field = u64::decode(input)?; Ok(Self(>::from_bits(field as u64).map_err(|_| "invalid value")?)) } diff --git a/substrate/frame/im-online/Cargo.toml b/substrate/frame/im-online/Cargo.toml index 53aa39ca51..e9b9e049a5 100644 --- a/substrate/frame/im-online/Cargo.toml +++ b/substrate/frame/im-online/Cargo.toml @@ -9,7 +9,7 @@ app-crypto = { package = "sc-application-crypto", path = "../../primitives/appli authorship = { package = "pallet-authorship", path = "../authorship", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } primitives = { package="sp-core", path = "../../primitives/core", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } serde = { version = "1.0.101", optional = true } session = { package = "pallet-session", path = "../session", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } @@ -25,7 +25,7 @@ std = [ "authorship/std", "codec/std", "primitives/std", - "rstd/std", + "sp-std/std", "serde", "session/std", "runtime-io/std", diff --git a/substrate/frame/im-online/src/lib.rs b/substrate/frame/im-online/src/lib.rs index 7892054b7f..24556b717e 100644 --- a/substrate/frame/im-online/src/lib.rs +++ b/substrate/frame/im-online/src/lib.rs @@ -73,8 +73,8 @@ mod tests; use app_crypto::RuntimeAppPublic; use codec::{Encode, Decode}; use primitives::offchain::{OpaqueNetworkState, StorageKind}; -use rstd::prelude::*; -use rstd::convert::TryInto; +use sp_std::prelude::*; +use sp_std::convert::TryInto; use session::historical::IdentificationTuple; use sp_runtime::{ RuntimeDebug, diff --git a/substrate/frame/indices/Cargo.toml b/substrate/frame/indices/Cargo.toml index 7571dc1e98..05e5bfd451 100644 --- a/substrate/frame/indices/Cargo.toml +++ b/substrate/frame/indices/Cargo.toml @@ -9,7 +9,7 @@ serde = { version = "1.0.101", optional = true } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } sp-keyring = { path = "../../primitives/keyring", optional = true } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } @@ -27,7 +27,7 @@ std = [ "sp-keyring", "codec/std", "primitives/std", - "rstd/std", + "sp-std/std", "runtime-io/std", "support/std", "sp-runtime/std", diff --git a/substrate/frame/indices/src/address.rs b/substrate/frame/indices/src/address.rs index cfc9bcabaa..2f0d343345 100644 --- a/substrate/frame/indices/src/address.rs +++ b/substrate/frame/indices/src/address.rs @@ -18,7 +18,7 @@ #[cfg(feature = "std")] use std::fmt; -use rstd::convert::TryInto; +use sp_std::convert::TryInto; use crate::Member; use codec::{Encode, Decode, Input, Output, Error}; diff --git a/substrate/frame/indices/src/lib.rs b/substrate/frame/indices/src/lib.rs index d53a26f77c..f74991e4ac 100644 --- a/substrate/frame/indices/src/lib.rs +++ b/substrate/frame/indices/src/lib.rs @@ -19,7 +19,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::{prelude::*, marker::PhantomData, convert::TryInto}; +use sp_std::{prelude::*, marker::PhantomData, convert::TryInto}; use codec::{Encode, Codec}; use support::{Parameter, decl_module, decl_event, decl_storage}; use sp_runtime::traits::{One, SimpleArithmetic, StaticLookup, Member, LookupError}; diff --git a/substrate/frame/membership/Cargo.toml b/substrate/frame/membership/Cargo.toml index d09ab23051..1973dfba19 100644 --- a/substrate/frame/membership/Cargo.toml +++ b/substrate/frame/membership/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } @@ -22,7 +22,7 @@ std = [ "serde", "codec/std", "sp-runtime/std", - "rstd/std", + "sp-std/std", "runtime-io/std", "support/std", "system/std", diff --git a/substrate/frame/membership/src/lib.rs b/substrate/frame/membership/src/lib.rs index 10be4e06f7..a7bbceaf27 100644 --- a/substrate/frame/membership/src/lib.rs +++ b/substrate/frame/membership/src/lib.rs @@ -22,7 +22,7 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use sp_std::prelude::*; use support::{ decl_module, decl_storage, decl_event, traits::{ChangeMembers, InitializeMembers}, @@ -63,7 +63,7 @@ decl_storage! { } add_extra_genesis { config(members): Vec; - config(phantom): rstd::marker::PhantomData; + config(phantom): sp_std::marker::PhantomData; build(|config: &Self| { let mut members = config.members.clone(); members.sort(); @@ -89,7 +89,7 @@ decl_event!( /// One of the members' keys changed. KeyChanged, /// Phantom member, never used. - Dummy(rstd::marker::PhantomData<(AccountId, Event)>), + Dummy(sp_std::marker::PhantomData<(AccountId, Event)>), } ); diff --git a/substrate/frame/metadata/Cargo.toml b/substrate/frame/metadata/Cargo.toml index 5ed5293633..0feeb14d59 100644 --- a/substrate/frame/metadata/Cargo.toml +++ b/substrate/frame/metadata/Cargo.toml @@ -7,14 +7,14 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } [features] default = ["std"] std = [ "codec/std", - "rstd/std", + "sp-std/std", "primitives/std", "serde", ] diff --git a/substrate/frame/metadata/src/lib.rs b/substrate/frame/metadata/src/lib.rs index 113273be02..e37733fc9d 100644 --- a/substrate/frame/metadata/src/lib.rs +++ b/substrate/frame/metadata/src/lib.rs @@ -27,7 +27,7 @@ use serde::Serialize; #[cfg(feature = "std")] use codec::{Decode, Input, Error}; use codec::{Encode, Output}; -use rstd::vec::Vec; +use sp_std::vec::Vec; use primitives::RuntimeDebug; #[cfg(feature = "std")] @@ -85,12 +85,12 @@ impl Eq for DecodeDifferent where B: Encode + Eq + PartialEq + 'static, O: Encode + Eq + PartialEq + 'static {} -impl rstd::fmt::Debug for DecodeDifferent +impl sp_std::fmt::Debug for DecodeDifferent where - B: rstd::fmt::Debug + Eq + 'static, - O: rstd::fmt::Debug + Eq + 'static, + B: sp_std::fmt::Debug + Eq + 'static, + O: sp_std::fmt::Debug + Eq + 'static, { - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { match self { DecodeDifferent::Encode(b) => b.fmt(f), DecodeDifferent::Decoded(o) => o.fmt(f), @@ -151,8 +151,8 @@ impl PartialEq for FnEncode { } } -impl rstd::fmt::Debug for FnEncode { - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { +impl sp_std::fmt::Debug for FnEncode { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { self.0().fmt(f) } } @@ -261,8 +261,8 @@ impl serde::Serialize for DefaultByteGetter { } } -impl rstd::fmt::Debug for DefaultByteGetter { - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { +impl sp_std::fmt::Debug for DefaultByteGetter { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { self.0.default_byte().fmt(f) } } diff --git a/substrate/frame/nicks/Cargo.toml b/substrate/frame/nicks/Cargo.toml index 70f6f9ba2f..d7d94a564d 100644 --- a/substrate/frame/nicks/Cargo.toml +++ b/substrate/frame/nicks/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -22,7 +22,7 @@ default = ["std"] std = [ "serde", "codec/std", - "rstd/std", + "sp-std/std", "runtime-io/std", "sp-runtime/std", "support/std", diff --git a/substrate/frame/nicks/src/lib.rs b/substrate/frame/nicks/src/lib.rs index cb35b1dba0..60b1d3e5cb 100644 --- a/substrate/frame/nicks/src/lib.rs +++ b/substrate/frame/nicks/src/lib.rs @@ -38,7 +38,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use sp_std::prelude::*; use sp_runtime::{ traits::{StaticLookup, EnsureOrigin, Zero} }; diff --git a/substrate/frame/offences/Cargo.toml b/substrate/frame/offences/Cargo.toml index 27d6344222..3f3a6d8b4c 100644 --- a/substrate/frame/offences/Cargo.toml +++ b/substrate/frame/offences/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] balances = { package = "pallet-balances", path = "../balances", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } serde = { version = "1.0.101", optional = true } sp-runtime = { path = "../../primitives/runtime", default-features = false } sp-staking = { path = "../../primitives/sr-staking-primitives", default-features = false } @@ -23,7 +23,7 @@ default = ["std"] std = [ "balances/std", "codec/std", - "rstd/std", + "sp-std/std", "serde", "sp-runtime/std", "sp-staking/std", diff --git a/substrate/frame/offences/src/lib.rs b/substrate/frame/offences/src/lib.rs index eb1f2abc3c..6d83de3652 100644 --- a/substrate/frame/offences/src/lib.rs +++ b/substrate/frame/offences/src/lib.rs @@ -24,7 +24,7 @@ mod mock; mod tests; -use rstd::vec::Vec; +use sp_std::vec::Vec; use support::{ decl_module, decl_event, decl_storage, Parameter, }; diff --git a/substrate/frame/randomness-collective-flip/Cargo.toml b/substrate/frame/randomness-collective-flip/Cargo.toml index bd8aef96f2..1ef171ab54 100644 --- a/substrate/frame/randomness-collective-flip/Cargo.toml +++ b/substrate/frame/randomness-collective-flip/Cargo.toml @@ -10,7 +10,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", default-features = sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } [dev-dependencies] primitives = { package = "sp-core", path = "../../primitives/core" } @@ -24,5 +24,5 @@ std = [ "codec/std", "support/std", "sp-runtime/std", - "rstd/std", + "sp-std/std", ] diff --git a/substrate/frame/randomness-collective-flip/src/lib.rs b/substrate/frame/randomness-collective-flip/src/lib.rs index 1a719ac915..a250f50092 100644 --- a/substrate/frame/randomness-collective-flip/src/lib.rs +++ b/substrate/frame/randomness-collective-flip/src/lib.rs @@ -52,7 +52,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::{prelude::*, convert::TryInto}; +use sp_std::{prelude::*, convert::TryInto}; use sp_runtime::traits::Hash; use support::{decl_module, decl_storage, traits::Randomness}; use safe_mix::TripletMix; diff --git a/substrate/frame/scored-pool/Cargo.toml b/substrate/frame/scored-pool/Cargo.toml index d61806c27c..a21998fcb7 100644 --- a/substrate/frame/scored-pool/Cargo.toml +++ b/substrate/frame/scored-pool/Cargo.toml @@ -9,7 +9,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", default-features = serde = { version = "1.0.101", optional = true } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } @@ -24,7 +24,7 @@ std = [ "serde", "runtime-io/std", "sp-runtime/std", - "rstd/std", + "sp-std/std", "support/std", "system/std", ] diff --git a/substrate/frame/scored-pool/src/lib.rs b/substrate/frame/scored-pool/src/lib.rs index 8a2bfb9051..9645560d53 100644 --- a/substrate/frame/scored-pool/src/lib.rs +++ b/substrate/frame/scored-pool/src/lib.rs @@ -89,7 +89,7 @@ mod mock; mod tests; use codec::FullCodec; -use rstd::{ +use sp_std::{ fmt::Debug, prelude::*, }; @@ -175,7 +175,7 @@ decl_storage! { } add_extra_genesis { config(members): Vec; - config(phantom): rstd::marker::PhantomData; + config(phantom): sp_std::marker::PhantomData; build(|config| { let mut pool = config.pool.clone(); @@ -218,7 +218,7 @@ decl_event!( /// See the transaction for who. CandidateScored, /// Phantom member, never used. - Dummy(rstd::marker::PhantomData<(AccountId, I)>), + Dummy(sp_std::marker::PhantomData<(AccountId, I)>), } ); @@ -453,4 +453,3 @@ impl, I: Instance> Module { Ok(()) } } - diff --git a/substrate/frame/session/Cargo.toml b/substrate/frame/session/Cargo.toml index f5ccfa34f9..e55c6b7bb2 100644 --- a/substrate/frame/session/Cargo.toml +++ b/substrate/frame/session/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" serde = { version = "1.0.101", optional = true } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } sp-staking = { path = "../../primitives/sr-staking-primitives", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -30,7 +30,7 @@ std = [ "serde", "safe-mix/std", "codec/std", - "rstd/std", + "sp-std/std", "support/std", "sp-runtime/std", "sp-staking/std", diff --git a/substrate/frame/session/src/historical.rs b/substrate/frame/session/src/historical.rs index c693313327..32e7203150 100644 --- a/substrate/frame/session/src/historical.rs +++ b/substrate/frame/session/src/historical.rs @@ -25,7 +25,7 @@ //! These roots and proofs of inclusion can be generated at any time during the current session. //! Afterwards, the proofs can be fed to a consensus module when reporting misbehavior. -use rstd::prelude::*; +use sp_std::prelude::*; use codec::{Encode, Decode}; use sp_runtime::KeyTypeId; use sp_runtime::traits::{Convert, OpaqueKeys, Hash as HashT}; @@ -79,7 +79,7 @@ impl Module { None => return, // nothing to prune. }; - let up_to = rstd::cmp::min(up_to, end); + let up_to = sp_std::cmp::min(up_to, end); if up_to < start { return // out of bounds. harmless. @@ -108,7 +108,7 @@ pub trait OnSessionEnding: crate::OnSessionEndi /// An `OnSessionEnding` implementation that wraps an inner `I` and also /// sets the historical trie root of the ending session. -pub struct NoteHistoricalRoot(rstd::marker::PhantomData<(T, I)>); +pub struct NoteHistoricalRoot(sp_std::marker::PhantomData<(T, I)>); impl crate::OnSessionEnding for NoteHistoricalRoot where I: OnSessionEnding diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 69273b9a43..c71d2dbfba 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -119,7 +119,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::{prelude::*, marker::PhantomData, ops::{Sub, Rem}}; +use sp_std::{prelude::*, marker::PhantomData, ops::{Sub, Rem}}; use codec::Decode; use sp_runtime::{KeyTypeId, Perbill, RuntimeAppPublic, BoundToRuntimeAppPublic}; use support::weights::SimpleDispatchInfo; @@ -625,7 +625,7 @@ impl Module { /// Returns `Ok(true)` if more than `DisabledValidatorsThreshold` validators in current /// session is already disabled. /// If used with the staking module it allows to force a new era in such case. - pub fn disable(c: &T::ValidatorId) -> rstd::result::Result { + pub fn disable(c: &T::ValidatorId) -> sp_std::result::Result { Self::validators().iter().position(|i| i == c).map(Self::disable_index).ok_or(()) } @@ -702,7 +702,7 @@ impl OnFreeBalanceZero for Module { /// Wraps the author-scraping logic for consensus engines that can recover /// the canonical index of an author. This then transforms it into the /// registering account-ID of that session key index. -pub struct FindAccountFromAuthorIndex(rstd::marker::PhantomData<(T, Inner)>); +pub struct FindAccountFromAuthorIndex(sp_std::marker::PhantomData<(T, Inner)>); impl> FindAuthor for FindAccountFromAuthorIndex diff --git a/substrate/frame/staking/Cargo.toml b/substrate/frame/staking/Cargo.toml index 0b042d5ca0..501527847e 100644 --- a/substrate/frame/staking/Cargo.toml +++ b/substrate/frame/staking/Cargo.toml @@ -9,7 +9,7 @@ serde = { version = "1.0.101", optional = true } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } sp-keyring = { path = "../../primitives/keyring", optional = true } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } phragmen = { package = "sp-phragmen", path = "../../primitives/phragmen", default-features = false } runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } @@ -35,7 +35,7 @@ std = [ "safe-mix/std", "sp-keyring", "codec/std", - "rstd/std", + "sp-std/std", "phragmen/std", "runtime-io/std", "support/std", diff --git a/substrate/frame/staking/src/lib.rs b/substrate/frame/staking/src/lib.rs index 76619a142d..952c0cbd62 100644 --- a/substrate/frame/staking/src/lib.rs +++ b/substrate/frame/staking/src/lib.rs @@ -255,7 +255,7 @@ mod slashing; pub mod inflation; -use rstd::{prelude::*, result}; +use sp_std::{prelude::*, result}; use codec::{HasCompact, Encode, Decode}; use support::{ decl_module, decl_event, decl_storage, ensure, @@ -445,7 +445,7 @@ impl StakingLedger where // don't leave a dust balance in the staking system. if *target <= minimum_balance { slash_from_target += *target; - *value += rstd::mem::replace(target, Zero::zero()); + *value += sp_std::mem::replace(target, Zero::zero()); } *total_remaining = total_remaining.saturating_sub(slash_from_target); @@ -1304,7 +1304,7 @@ impl Module { let points = CurrentEraPointsEarned::take(); let now = T::Time::now(); let previous_era_start = >::mutate(|v| { - rstd::mem::replace(v, now) + sp_std::mem::replace(v, now) }); let era_duration = now - previous_era_start; if !era_duration.is_zero() { @@ -1641,7 +1641,7 @@ impl authorship::EventHandler(rstd::marker::PhantomData); +pub struct StashOf(sp_std::marker::PhantomData); impl Convert> for StashOf { fn convert(controller: T::AccountId) -> Option { @@ -1651,7 +1651,7 @@ impl Convert> for StashOf { /// A typed conversion from stash account ID to the current exposure of nominators /// on that account. -pub struct ExposureOf(rstd::marker::PhantomData); +pub struct ExposureOf(sp_std::marker::PhantomData); impl Convert>>> for ExposureOf @@ -1751,7 +1751,7 @@ impl OnOffenceHandler { - _inner: rstd::marker::PhantomData<(T, R)>, + _inner: sp_std::marker::PhantomData<(T, R)>, } impl ReportOffence diff --git a/substrate/frame/staking/src/migration.rs b/substrate/frame/staking/src/migration.rs index e89c6af1b9..4c4306253e 100644 --- a/substrate/frame/staking/src/migration.rs +++ b/substrate/frame/staking/src/migration.rs @@ -26,7 +26,7 @@ pub const CURRENT_VERSION: VersionNumber = 1; mod inner { use crate::{Store, Module, Trait}; use support::{StorageLinkedMap, StorageValue}; - use rstd::vec::Vec; + use sp_std::vec::Vec; use super::{CURRENT_VERSION, VersionNumber}; // the minimum supported version of the migration logic. diff --git a/substrate/frame/staking/src/slashing.rs b/substrate/frame/staking/src/slashing.rs index e8515c0f40..54b14a0cf8 100644 --- a/substrate/frame/staking/src/slashing.rs +++ b/substrate/frame/staking/src/slashing.rs @@ -57,7 +57,7 @@ use support::{ StorageMap, StorageDoubleMap, traits::{Currency, OnUnbalanced, Imbalance}, }; -use rstd::vec::Vec; +use sp_std::vec::Vec; use codec::{Encode, Decode}; /// The proportion of the slashing reward to be paid out on the first slashing detection. @@ -133,7 +133,7 @@ impl SlashingSpans { SlashingSpan { index, start, length: Some(length) } }); - rstd::iter::once(last).chain(prior) + sp_std::iter::once(last).chain(prior) } /// Yields the era index where the last (current) slashing span started. @@ -161,7 +161,7 @@ impl SlashingSpans { }; // readjust the ongoing span, if it started before the beginning of the window. - self.last_start = rstd::cmp::max(self.last_start, window_start); + self.last_start = sp_std::cmp::max(self.last_start, window_start); pruned } } @@ -419,7 +419,7 @@ struct InspectingSpans<'a, T: Trait + 'a> { paid_out: &'a mut BalanceOf, slash_of: &'a mut BalanceOf, reward_proportion: Perbill, - _marker: rstd::marker::PhantomData, + _marker: sp_std::marker::PhantomData, } // fetches the slashing spans record for a stash account, initializing it if necessary. @@ -444,7 +444,7 @@ fn fetch_spans<'a, T: Trait + 'a>( slash_of, paid_out, reward_proportion, - _marker: rstd::marker::PhantomData, + _marker: sp_std::marker::PhantomData, } } diff --git a/substrate/frame/sudo/Cargo.toml b/substrate/frame/sudo/Cargo.toml index 5e7cf92812..f16c0013b8 100644 --- a/substrate/frame/sudo/Cargo.toml +++ b/substrate/frame/sudo/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -21,7 +21,7 @@ default = ["std"] std = [ "serde", "codec/std", - "rstd/std", + "sp-std/std", "runtime-io/std", "sp-runtime/std", "support/std", diff --git a/substrate/frame/sudo/src/lib.rs b/substrate/frame/sudo/src/lib.rs index fa470b1785..13daa23971 100644 --- a/substrate/frame/sudo/src/lib.rs +++ b/substrate/frame/sudo/src/lib.rs @@ -86,7 +86,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use sp_std::prelude::*; use sp_runtime::{ traits::{StaticLookup, Dispatchable}, DispatchError, }; diff --git a/substrate/frame/support/Cargo.toml b/substrate/frame/support/Cargo.toml index c74b6b03e2..0f897bcda8 100644 --- a/substrate/frame/support/Cargo.toml +++ b/substrate/frame/support/Cargo.toml @@ -9,7 +9,7 @@ log = "0.4" serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] } frame-metadata = { path = "../metadata", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } @@ -36,7 +36,7 @@ std = [ "serde", "runtime-io/std", "codec/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", "sp-arithmetic/std", "frame-metadata/std", diff --git a/substrate/frame/support/procedural/src/storage/genesis_config/builder_def.rs b/substrate/frame/support/procedural/src/storage/genesis_config/builder_def.rs index 78c659d466..7edee59de8 100644 --- a/substrate/frame/support/procedural/src/storage/genesis_config/builder_def.rs +++ b/substrate/frame/support/procedural/src/storage/genesis_config/builder_def.rs @@ -92,7 +92,7 @@ impl BuilderDef { let key = &map.key; quote!{{ #data - let data: &#scrate::rstd::vec::Vec<(#key, #value_type)> = data; + let data: &#scrate::sp_std::vec::Vec<(#key, #value_type)> = data; data.iter().for_each(|(k, v)| { <#storage_struct as #scrate::#storage_trait>::insert::< &#key, &#value_type @@ -105,7 +105,7 @@ impl BuilderDef { let key2 = &map.key2; quote!{{ #data - let data: &#scrate::rstd::vec::Vec<(#key1, #key2, #value_type)> = data; + let data: &#scrate::sp_std::vec::Vec<(#key1, #key2, #value_type)> = data; data.iter().for_each(|(k1, k2, v)| { <#storage_struct as #scrate::#storage_trait>::insert::< &#key1, &#key2, &#value_type diff --git a/substrate/frame/support/procedural/src/storage/metadata.rs b/substrate/frame/support/procedural/src/storage/metadata.rs index b5ccb8a07a..17ad250f66 100644 --- a/substrate/frame/support/procedural/src/storage/metadata.rs +++ b/substrate/frame/support/procedural/src/storage/metadata.rs @@ -104,11 +104,11 @@ fn default_byte_getter( #[doc(hidden)] pub struct #struct_name< #runtime_generic, #optional_instance_bound_optional_default - >(pub #scrate::rstd::marker::PhantomData<(#runtime_generic #optional_comma_instance)>); + >(pub #scrate::sp_std::marker::PhantomData<(#runtime_generic #optional_comma_instance)>); #[cfg(feature = "std")] #[allow(non_upper_case_globals)] - static #cache_name: #scrate::once_cell::sync::OnceCell<#scrate::rstd::vec::Vec> = + static #cache_name: #scrate::once_cell::sync::OnceCell<#scrate::sp_std::vec::Vec> = #scrate::once_cell::sync::OnceCell::new(); #[cfg(feature = "std")] @@ -117,7 +117,7 @@ fn default_byte_getter( for #struct_name<#runtime_generic, #optional_instance> #where_clause { - fn default_byte(&self) -> #scrate::rstd::vec::Vec { + fn default_byte(&self) -> #scrate::sp_std::vec::Vec { use #scrate::codec::Encode; #cache_name.get_or_init(|| { let def_val: #query_type = #default; @@ -138,7 +138,7 @@ fn default_byte_getter( for #struct_name<#runtime_generic, #optional_instance> #where_clause { - fn default_byte(&self) -> #scrate::rstd::vec::Vec { + fn default_byte(&self) -> #scrate::sp_std::vec::Vec { use #scrate::codec::Encode; let def_val: #query_type = #default; <#query_type as Encode>::encode(&def_val) @@ -146,7 +146,7 @@ fn default_byte_getter( } }; let struct_instance = quote!( - #struct_name::<#runtime_generic, #optional_instance>(#scrate::rstd::marker::PhantomData) + #struct_name::<#runtime_generic, #optional_instance>(#scrate::sp_std::marker::PhantomData) ); (struct_def, struct_instance) diff --git a/substrate/frame/support/procedural/src/storage/storage_struct.rs b/substrate/frame/support/procedural/src/storage/storage_struct.rs index 97aea3567d..fdb1dbb161 100644 --- a/substrate/frame/support/procedural/src/storage/storage_struct.rs +++ b/substrate/frame/support/procedural/src/storage/storage_struct.rs @@ -68,7 +68,7 @@ pub fn decl_and_impl(scrate: &TokenStream, def: &DeclStorageDefExt) -> TokenStre #visibility struct #name< #optional_storage_runtime_bound_comma #optional_instance_bound_optional_default >( - #scrate::rstd::marker::PhantomData< + #scrate::sp_std::marker::PhantomData< (#optional_storage_runtime_comma #optional_instance) > ) #optional_storage_where_clause; diff --git a/substrate/frame/support/src/debug.rs b/substrate/frame/support/src/debug.rs index feb8e6d873..c872bc79df 100644 --- a/substrate/frame/support/src/debug.rs +++ b/substrate/frame/support/src/debug.rs @@ -86,8 +86,8 @@ //! native::print!("My struct: {:?}", x); //! ``` -use rstd::vec::Vec; -use rstd::fmt::{self, Debug}; +use sp_std::vec::Vec; +use sp_std::fmt::{self, Debug}; pub use log::{info, debug, error, trace, warn}; pub use crate::runtime_print as print; diff --git a/substrate/frame/support/src/dispatch.rs b/substrate/frame/support/src/dispatch.rs index d80b8ca440..8432dd2cec 100644 --- a/substrate/frame/support/src/dispatch.rs +++ b/substrate/frame/support/src/dispatch.rs @@ -17,7 +17,7 @@ //! Dispatch system. Contains a macro for defining runtime modules and //! generating values representing lazy module function calls. -pub use crate::rstd::{result, fmt, prelude::{Vec, Clone, Eq, PartialEq}, marker}; +pub use crate::sp_std::{result, fmt, prelude::{Vec, Clone, Eq, PartialEq}, marker}; pub use crate::codec::{Codec, EncodeLike, Decode, Encode, Input, Output, HasCompact, EncodeAsRef}; pub use frame_metadata::{ FunctionMetadata, DecodeDifferent, DecodeDifferentArray, FunctionArgumentMetadata, @@ -865,7 +865,7 @@ macro_rules! decl_module { for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )* { fn on_initialize(_block_number_not_used: $trait_instance::BlockNumber) { - use $crate::rstd::if_std; + use $crate::sp_std::if_std; if_std! { use $crate::tracing; let span = tracing::span!(tracing::Level::DEBUG, "on_initialize"); @@ -887,7 +887,7 @@ macro_rules! decl_module { for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )* { fn on_initialize($param: $param_ty) { - use $crate::rstd::if_std; + use $crate::sp_std::if_std; if_std! { use $crate::tracing; let span = tracing::span!(tracing::Level::DEBUG, "on_initialize"); @@ -919,7 +919,7 @@ macro_rules! decl_module { for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )* { fn on_finalize(_block_number_not_used: $trait_instance::BlockNumber) { - use $crate::rstd::if_std; + use $crate::sp_std::if_std; if_std! { use $crate::tracing; let span = tracing::span!(tracing::Level::DEBUG, "on_finalize"); @@ -941,7 +941,7 @@ macro_rules! decl_module { for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )* { fn on_finalize($param: $param_ty) { - use $crate::rstd::if_std; + use $crate::sp_std::if_std; if_std! { use $crate::tracing; let span = tracing::span!(tracing::Level::DEBUG, "on_finalize"); @@ -1044,7 +1044,7 @@ macro_rules! decl_module { $vis fn $name( $origin: $origin_ty $(, $param: $param_ty )* ) -> $crate::dispatch::DispatchResult<$error_type> { - use $crate::rstd::if_std; + use $crate::sp_std::if_std; if_std! { use $crate::tracing; let span = tracing::span!(tracing::Level::DEBUG, stringify!($name)); @@ -1070,7 +1070,7 @@ macro_rules! decl_module { ) => { $(#[doc = $doc_attr])* $vis fn $name($origin: $origin_ty $(, $param: $param_ty )* ) -> $result { - use $crate::rstd::if_std; + use $crate::sp_std::if_std; if_std! { use $crate::tracing; let span = tracing::span!(tracing::Level::DEBUG, stringify!($name)); @@ -1193,7 +1193,7 @@ macro_rules! decl_module { { #[doc(hidden)] #[codec(skip)] - __PhantomItem($crate::rstd::marker::PhantomData<($trait_instance $(, $instance)?)>, $crate::dispatch::Never), + __PhantomItem($crate::sp_std::marker::PhantomData<($trait_instance $(, $instance)?)>, $crate::dispatch::Never), $( $generated_variants )* } }; @@ -1231,7 +1231,7 @@ macro_rules! decl_module { pub struct $mod_type< $trait_instance: $trait_name $(, $instance: $instantiable $( = $module_default_instance)?)? - >($crate::rstd::marker::PhantomData<($trait_instance $(, $instance)?)>) where + >($crate::sp_std::marker::PhantomData<($trait_instance $(, $instance)?)>) where $( $other_where_bounds )*; $crate::decl_module! { diff --git a/substrate/frame/support/src/event.rs b/substrate/frame/support/src/event.rs index c2e962ffb2..5b8ce1830e 100644 --- a/substrate/frame/support/src/event.rs +++ b/substrate/frame/support/src/event.rs @@ -280,7 +280,7 @@ macro_rules! __decl_generic_event { $( #[doc(hidden)] #[codec(skip)] - PhantomData($crate::rstd::marker::PhantomData<$instance>), + PhantomData($crate::sp_std::marker::PhantomData<$instance>), )? } impl<$( $generic_param ),* $(, $instance)? > From> for () { @@ -486,12 +486,12 @@ macro_rules! impl_outer_event { $name::[< $module_name $(_ $generic_instance )? >](x) } } - impl $crate::rstd::convert::TryInto< + impl $crate::sp_std::convert::TryInto< $module_name::Event < $( $generic_param, )? $( $module_name::$generic_instance )? > > for $name { type Error = (); - fn try_into(self) -> $crate::rstd::result::Result< + fn try_into(self) -> $crate::sp_std::result::Result< $module_name::Event < $( $generic_param, )? $( $module_name::$generic_instance )? >, Self::Error > { match self { diff --git a/substrate/frame/support/src/hash.rs b/substrate/frame/support/src/hash.rs index d51df162e5..74a061dfc4 100644 --- a/substrate/frame/support/src/hash.rs +++ b/substrate/frame/support/src/hash.rs @@ -17,7 +17,7 @@ //! Hash utilities. use codec::Codec; -use rstd::prelude::Vec; +use sp_std::prelude::Vec; use runtime_io::hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256}; // This trait must be kept coherent with frame-support-procedural HasherKind usage diff --git a/substrate/frame/support/src/inherent.rs b/substrate/frame/support/src/inherent.rs index 540a27f7cc..5dfb1bade8 100644 --- a/substrate/frame/support/src/inherent.rs +++ b/substrate/frame/support/src/inherent.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . #[doc(hidden)] -pub use crate::rstd::vec::Vec; +pub use crate::sp_std::vec::Vec; #[doc(hidden)] pub use crate::sp_runtime::traits::{Block as BlockT, Extrinsic}; #[doc(hidden)] diff --git a/substrate/frame/support/src/lib.rs b/substrate/frame/support/src/lib.rs index 35962eba88..7c121d7ebf 100644 --- a/substrate/frame/support/src/lib.rs +++ b/substrate/frame/support/src/lib.rs @@ -29,7 +29,7 @@ pub extern crate tracing; #[cfg(feature = "std")] pub use serde; #[doc(hidden)] -pub use rstd; +pub use sp_std; #[doc(hidden)] pub use codec; #[cfg(feature = "std")] @@ -204,7 +204,7 @@ mod tests { DecodeDifferent, StorageEntryMetadata, StorageMetadata, StorageEntryType, StorageEntryModifier, DefaultByteGetter, StorageHasher, }; - use rstd::marker::PhantomData; + use sp_std::marker::PhantomData; pub trait Trait { type BlockNumber: Codec + EncodeLike + Default; diff --git a/substrate/frame/support/src/origin.rs b/substrate/frame/support/src/origin.rs index 6da9bc1385..22e5c99e90 100644 --- a/substrate/frame/support/src/origin.rs +++ b/substrate/frame/support/src/origin.rs @@ -178,8 +178,8 @@ macro_rules! impl_outer_origin { $name::system(x) } } - impl Into<$crate::rstd::result::Result<$system::Origin<$runtime>, $name>> for $name { - fn into(self) -> $crate::rstd::result::Result<$system::Origin<$runtime>, Self> { + impl Into<$crate::sp_std::result::Result<$system::Origin<$runtime>, $name>> for $name { + fn into(self) -> $crate::sp_std::result::Result<$system::Origin<$runtime>, Self> { if let $name::system(l) = self { Ok(l) } else { @@ -200,12 +200,12 @@ macro_rules! impl_outer_origin { } } impl Into< - $crate::rstd::result::Result< + $crate::sp_std::result::Result< $module::Origin < $( $generic )? $(, $module::$generic_instance )? >, $name, >> for $name { - fn into(self) -> $crate::rstd::result::Result< + fn into(self) -> $crate::sp_std::result::Result< $module::Origin < $( $generic )? $(, $module::$generic_instance )? >, Self, > { diff --git a/substrate/frame/support/src/storage/child.rs b/substrate/frame/support/src/storage/child.rs index bc6150c52f..1930de57bb 100644 --- a/substrate/frame/support/src/storage/child.rs +++ b/substrate/frame/support/src/storage/child.rs @@ -21,7 +21,7 @@ //! avoid collision from a resistant hash function (which unique implies)). // NOTE: could replace unhashed by having only one kind of storage (root being null storage key (storage_key can become Option<&[u8]>). -use crate::rstd::prelude::*; +use crate::sp_std::prelude::*; use codec::{Codec, Encode, Decode}; /// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. diff --git a/substrate/frame/support/src/storage/generator/double_map.rs b/substrate/frame/support/src/storage/generator/double_map.rs index 8917cbf952..fd938001ae 100644 --- a/substrate/frame/support/src/storage/generator/double_map.rs +++ b/substrate/frame/support/src/storage/generator/double_map.rs @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use rstd::prelude::*; -use rstd::borrow::Borrow; +use sp_std::prelude::*; +use sp_std::borrow::Borrow; use codec::{Ref, FullCodec, FullEncode, Encode, EncodeLike, EncodeAppend}; use crate::{storage::{self, unhashed}, hash::{StorageHasher, Twox128}, traits::Len}; diff --git a/substrate/frame/support/src/storage/generator/linked_map.rs b/substrate/frame/support/src/storage/generator/linked_map.rs index fb0603fce7..b4b6daf276 100644 --- a/substrate/frame/support/src/storage/generator/linked_map.rs +++ b/substrate/frame/support/src/storage/generator/linked_map.rs @@ -16,7 +16,7 @@ use codec::{FullCodec, Encode, Decode, EncodeLike, Ref}; use crate::{storage::{self, unhashed}, hash::{StorageHasher, Twox128}, traits::Len}; -use rstd::{prelude::*, marker::PhantomData}; +use sp_std::{prelude::*, marker::PhantomData}; /// Generator for `StorageLinkedMap` used by `decl_storage`. /// diff --git a/substrate/frame/support/src/storage/generator/map.rs b/substrate/frame/support/src/storage/generator/map.rs index 926fe8748d..fd9f1f901d 100644 --- a/substrate/frame/support/src/storage/generator/map.rs +++ b/substrate/frame/support/src/storage/generator/map.rs @@ -15,8 +15,8 @@ // along with Substrate. If not, see . #[cfg(not(feature = "std"))] -use rstd::prelude::*; -use rstd::borrow::Borrow; +use sp_std::prelude::*; +use sp_std::borrow::Borrow; use codec::{FullCodec, FullEncode, Encode, EncodeLike, Ref, EncodeAppend}; use crate::{storage::{self, unhashed}, hash::{StorageHasher, Twox128}, traits::Len}; diff --git a/substrate/frame/support/src/storage/generator/value.rs b/substrate/frame/support/src/storage/generator/value.rs index 0cf143bac1..cc45439f5b 100644 --- a/substrate/frame/support/src/storage/generator/value.rs +++ b/substrate/frame/support/src/storage/generator/value.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . #[cfg(not(feature = "std"))] -use rstd::prelude::*; +use sp_std::prelude::*; use codec::{FullCodec, Encode, EncodeAppend, EncodeLike, Decode}; use crate::{storage::{self, unhashed}, hash::{Twox128, StorageHasher}, traits::Len}; diff --git a/substrate/frame/support/src/storage/hashed.rs b/substrate/frame/support/src/storage/hashed.rs index 2eca8f5bca..d4740795db 100644 --- a/substrate/frame/support/src/storage/hashed.rs +++ b/substrate/frame/support/src/storage/hashed.rs @@ -17,7 +17,7 @@ //! Operation on runtime storage using hashed keys. use super::unhashed; -use rstd::prelude::*; +use sp_std::prelude::*; use codec::{Encode, Decode}; /// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. diff --git a/substrate/frame/support/src/storage/mod.rs b/substrate/frame/support/src/storage/mod.rs index 08d45571d1..d6de37ca7a 100644 --- a/substrate/frame/support/src/storage/mod.rs +++ b/substrate/frame/support/src/storage/mod.rs @@ -16,7 +16,7 @@ //! Stuff to do with the runtime's storage. -use rstd::{prelude::*, marker::PhantomData}; +use sp_std::{prelude::*, marker::PhantomData}; use codec::{FullCodec, FullEncode, Encode, EncodeAppend, EncodeLike, Decode}; use crate::{traits::Len, hash::{Twox128, StorageHasher}}; diff --git a/substrate/frame/support/src/storage/unhashed.rs b/substrate/frame/support/src/storage/unhashed.rs index a128f6bf18..c13686cf93 100644 --- a/substrate/frame/support/src/storage/unhashed.rs +++ b/substrate/frame/support/src/storage/unhashed.rs @@ -16,7 +16,7 @@ //! Operation on unhashed runtime storage. -use rstd::prelude::*; +use sp_std::prelude::*; use codec::{Encode, Decode}; /// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. diff --git a/substrate/frame/support/src/traits.rs b/substrate/frame/support/src/traits.rs index 0a94483ec3..ae1695b3d3 100644 --- a/substrate/frame/support/src/traits.rs +++ b/substrate/frame/support/src/traits.rs @@ -18,7 +18,7 @@ //! //! NOTE: If you're looking for `parameter_types`, it has moved in to the top-level module. -use rstd::{prelude::*, result, marker::PhantomData, ops::Div, fmt::Debug}; +use sp_std::{prelude::*, result, marker::PhantomData, ops::Div, fmt::Debug}; use codec::{FullCodec, Codec, Encode, Decode}; use primitives::u32_trait::Value as U32; use sp_runtime::{ @@ -777,4 +777,3 @@ pub trait ValidatorRegistration { /// module fn is_registered(id: &ValidatorId) -> bool; } - diff --git a/substrate/frame/system/Cargo.toml b/substrate/frame/system/Cargo.toml index 93356c0ca6..81390d2d0e 100644 --- a/substrate/frame/system/Cargo.toml +++ b/substrate/frame/system/Cargo.toml @@ -9,7 +9,7 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } primitives = { package = "sp-core", path = "../../primitives/core", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } sp-version = { path = "../../primitives/sr-version", default-features = false } @@ -26,7 +26,7 @@ std = [ "safe-mix/std", "codec/std", "primitives/std", - "rstd/std", + "sp-std/std", "runtime-io/std", "support/std", "sp-runtime/std", diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index cce3468639..cec92d7f82 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -90,11 +90,11 @@ #[cfg(feature = "std")] use serde::Serialize; -use rstd::prelude::*; +use sp_std::prelude::*; #[cfg(any(feature = "std", test))] -use rstd::map; -use rstd::marker::PhantomData; -use rstd::fmt::Debug; +use sp_std::map; +use sp_std::marker::PhantomData; +use sp_std::fmt::Debug; use sp_version::RuntimeVersion; use sp_runtime::{ RuntimeDebug, @@ -172,12 +172,12 @@ pub trait Trait: 'static + Eq + Clone { /// The block number type used by the runtime. type BlockNumber: Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + SimpleArithmetic - + Default + Bounded + Copy + rstd::hash::Hash; + + Default + Bounded + Copy + sp_std::hash::Hash; /// The output of the `Hashing` function. type Hash: Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + SimpleBitOps - + Default + Copy + CheckEqual + rstd::hash::Hash + AsRef<[u8]> + AsMut<[u8]>; + + Default + Copy + CheckEqual + sp_std::hash::Hash + AsRef<[u8]> + AsMut<[u8]>; /// The hashing system (algorithm) being used in the runtime (e.g. Blake2). type Hashing: Hash; @@ -435,7 +435,7 @@ decl_storage! { } } -pub struct EnsureRoot(rstd::marker::PhantomData); +pub struct EnsureRoot(sp_std::marker::PhantomData); impl< O: Into, O>> + From>, AccountId, @@ -449,7 +449,7 @@ impl< } } -pub struct EnsureSigned(rstd::marker::PhantomData); +pub struct EnsureSigned(sp_std::marker::PhantomData); impl< O: Into, O>> + From>, AccountId, @@ -463,7 +463,7 @@ impl< } } -pub struct EnsureSignedBy(rstd::marker::PhantomData<(Who, AccountId)>); +pub struct EnsureSignedBy(sp_std::marker::PhantomData<(Who, AccountId)>); impl< O: Into, O>> + From>, Who: Contains, @@ -478,7 +478,7 @@ impl< } } -pub struct EnsureNone(rstd::marker::PhantomData); +pub struct EnsureNone(sp_std::marker::PhantomData); impl< O: Into, O>> + From>, AccountId, @@ -492,7 +492,7 @@ impl< } } -pub struct EnsureNever(rstd::marker::PhantomData); +pub struct EnsureNever(sp_std::marker::PhantomData); impl EnsureOrigin for EnsureNever { type Success = T; fn try_origin(o: O) -> Result { @@ -859,7 +859,7 @@ impl SignedExtension for CheckWeight { type DispatchInfo = DispatchInfo; type Pre = (); - fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) } + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } fn pre_dispatch( self, @@ -899,12 +899,12 @@ impl SignedExtension for CheckWeight { impl Debug for CheckWeight { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "CheckWeight") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -922,12 +922,12 @@ impl CheckNonce { impl Debug for CheckNonce { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { self.0.fmt(f) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -939,7 +939,7 @@ impl SignedExtension for CheckNonce { type DispatchInfo = DispatchInfo; type Pre = (); - fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) } + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } fn pre_dispatch( self, @@ -995,23 +995,23 @@ impl SignedExtension for CheckNonce { /// Check for transaction mortality. #[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckEra((Era, rstd::marker::PhantomData)); +pub struct CheckEra((Era, sp_std::marker::PhantomData)); impl CheckEra { /// utility constructor. Used only in client/factory code. pub fn from(era: Era) -> Self { - Self((era, rstd::marker::PhantomData)) + Self((era, sp_std::marker::PhantomData)) } } impl Debug for CheckEra { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { self.0.fmt(f) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -1051,16 +1051,16 @@ impl SignedExtension for CheckEra { /// Nonce check and increment to give replay protection for transactions. #[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckGenesis(rstd::marker::PhantomData); +pub struct CheckGenesis(sp_std::marker::PhantomData); impl Debug for CheckGenesis { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "CheckGenesis") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -1068,7 +1068,7 @@ impl Debug for CheckGenesis { impl CheckGenesis { /// Creates new `SignedExtension` to check genesis hash. pub fn new() -> Self { - Self(rstd::marker::PhantomData) + Self(sp_std::marker::PhantomData) } } @@ -1086,16 +1086,16 @@ impl SignedExtension for CheckGenesis { /// Ensure the runtime version registered in the transaction is the same as at present. #[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckVersion(rstd::marker::PhantomData); +pub struct CheckVersion(sp_std::marker::PhantomData); impl Debug for CheckVersion { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "CheckVersion") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -1103,7 +1103,7 @@ impl Debug for CheckVersion { impl CheckVersion { /// Create new `SignedExtension` to check runtime version. pub fn new() -> Self { - Self(rstd::marker::PhantomData) + Self(sp_std::marker::PhantomData) } } @@ -1119,10 +1119,10 @@ impl SignedExtension for CheckVersion { } } -pub struct ChainContext(rstd::marker::PhantomData); +pub struct ChainContext(sp_std::marker::PhantomData); impl Default for ChainContext { fn default() -> Self { - ChainContext(rstd::marker::PhantomData) + ChainContext(sp_std::marker::PhantomData) } } diff --git a/substrate/frame/system/src/offchain.rs b/substrate/frame/system/src/offchain.rs index 492dfefb6b..a12c9c3d06 100644 --- a/substrate/frame/system/src/offchain.rs +++ b/substrate/frame/system/src/offchain.rs @@ -41,7 +41,7 @@ impl Signer for AppPublic where Signature: From< <::Signature as app_crypto::AppSignature>::Generic >, - Public: rstd::convert::TryInto<::Generic> + Public: sp_std::convert::TryInto<::Generic> { fn sign(public: Public, raw_payload: &Payload) -> Option { raw_payload.using_encoded(|payload| { @@ -132,7 +132,7 @@ pub trait SubmitUnsignedTransaction { /// A default type used to submit transactions to the pool. pub struct TransactionSubmitter { - _signer: rstd::marker::PhantomData<(S, C, E)>, + _signer: sp_std::marker::PhantomData<(S, C, E)>, } impl Default for TransactionSubmitter { diff --git a/substrate/frame/timestamp/Cargo.toml b/substrate/frame/timestamp/Cargo.toml index c6eac45f98..e23bcec013 100644 --- a/substrate/frame/timestamp/Cargo.toml +++ b/substrate/frame/timestamp/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } inherents = { package = "sp-inherents", path = "../../primitives/inherents", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } @@ -24,7 +24,7 @@ default = ["std"] std = [ "inherents/std", "codec/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", "support/std", "serde", diff --git a/substrate/frame/timestamp/src/lib.rs b/substrate/frame/timestamp/src/lib.rs index 9368c09b67..0c415dbe9a 100644 --- a/substrate/frame/timestamp/src/lib.rs +++ b/substrate/frame/timestamp/src/lib.rs @@ -90,7 +90,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::{result, cmp}; +use sp_std::{result, cmp}; use inherents::{ProvideInherent, InherentData, InherentIdentifier}; use support::{Parameter, decl_storage, decl_module}; use support::traits::{Time, Get}; diff --git a/substrate/frame/transaction-payment/Cargo.toml b/substrate/frame/transaction-payment/Cargo.toml index 9163a0a7d8..696b5e4b6b 100644 --- a/substrate/frame/transaction-payment/Cargo.toml +++ b/substrate/frame/transaction-payment/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } @@ -21,7 +21,7 @@ balances = { package = "pallet-balances", path = "../balances" } default = ["std"] std = [ "codec/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", "support/std", "system/std", diff --git a/substrate/frame/transaction-payment/rpc/runtime-api/Cargo.toml b/substrate/frame/transaction-payment/rpc/runtime-api/Cargo.toml index 559d59e808..d55919a60d 100644 --- a/substrate/frame/transaction-payment/rpc/runtime-api/Cargo.toml +++ b/substrate/frame/transaction-payment/rpc/runtime-api/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-api = { path = "../../../../primitives/sr-api", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../../../primitives/sr-std", default-features = false } +sp-std = { path = "../../../../primitives/std", default-features = false } sp-runtime = { path = "../../../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../../../support", default-features = false } @@ -21,7 +21,7 @@ std = [ "serde", "sp-api/std", "codec/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", "support/std", ] diff --git a/substrate/frame/transaction-payment/rpc/runtime-api/src/lib.rs b/substrate/frame/transaction-payment/rpc/runtime-api/src/lib.rs index 549f67c98c..8de2e847ac 100644 --- a/substrate/frame/transaction-payment/rpc/runtime-api/src/lib.rs +++ b/substrate/frame/transaction-payment/rpc/runtime-api/src/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use sp_std::prelude::*; use support::weights::{Weight, DispatchClass}; use codec::{Encode, Codec, Decode}; #[cfg(feature = "std")] diff --git a/substrate/frame/transaction-payment/src/lib.rs b/substrate/frame/transaction-payment/src/lib.rs index eacf890d80..e51468b4f6 100644 --- a/substrate/frame/transaction-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/src/lib.rs @@ -31,7 +31,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use sp_std::prelude::*; use codec::{Encode, Decode}; use support::{ decl_storage, decl_module, @@ -179,13 +179,13 @@ impl ChargeTransactionPayment { } } -impl rstd::fmt::Debug for ChargeTransactionPayment { +impl sp_std::fmt::Debug for ChargeTransactionPayment { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "ChargeTransactionPayment<{:?}>", self.0) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -198,7 +198,7 @@ impl SignedExtension for ChargeTransactionPayment type AdditionalSigned = (); type DispatchInfo = DispatchInfo; type Pre = (); - fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) } + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } fn validate( &self, @@ -248,7 +248,7 @@ mod tests { traits::{BlakeTwo256, IdentityLookup, Extrinsic}, }; use balances::Call as BalancesCall; - use rstd::cell::RefCell; + use sp_std::cell::RefCell; use transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; const CALL: &::Call = &Call::Balances(BalancesCall::transfer(2, 69)); @@ -543,4 +543,3 @@ mod tests { }); } } - diff --git a/substrate/frame/treasury/Cargo.toml b/substrate/frame/treasury/Cargo.toml index 6f3d53af5e..5b4acd9808 100644 --- a/substrate/frame/treasury/Cargo.toml +++ b/substrate/frame/treasury/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } @@ -22,7 +22,7 @@ default = ["std"] std = [ "serde", "codec/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", "support/std", "system/std", diff --git a/substrate/frame/treasury/src/lib.rs b/substrate/frame/treasury/src/lib.rs index d5ca4b232e..510dc5348d 100644 --- a/substrate/frame/treasury/src/lib.rs +++ b/substrate/frame/treasury/src/lib.rs @@ -59,7 +59,7 @@ #[cfg(feature = "std")] use serde::{Serialize, Deserialize}; -use rstd::prelude::*; +use sp_std::prelude::*; use support::{decl_module, decl_storage, decl_event, ensure, print}; use support::traits::{ Currency, ExistenceRequirement, Get, Imbalance, OnUnbalanced, diff --git a/substrate/frame/utility/Cargo.toml b/substrate/frame/utility/Cargo.toml index 149db67a63..5246e86c82 100644 --- a/substrate/frame/utility/Cargo.toml +++ b/substrate/frame/utility/Cargo.toml @@ -10,7 +10,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", default-features = support = { package = "frame-support", path = "../support", default-features = false } system = { package = "frame-system", path = "../system", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } [dev-dependencies] @@ -26,5 +26,5 @@ std = [ "support/std", "system/std", "runtime-io/std", - "rstd/std" + "sp-std/std" ] diff --git a/substrate/frame/utility/src/lib.rs b/substrate/frame/utility/src/lib.rs index 20222766f4..0565997e3d 100644 --- a/substrate/frame/utility/src/lib.rs +++ b/substrate/frame/utility/src/lib.rs @@ -20,7 +20,7 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use sp_std::prelude::*; use support::{decl_module, decl_event, Parameter, weights::SimpleDispatchInfo}; use system::ensure_root; use sp_runtime::{traits::Dispatchable, DispatchError}; diff --git a/substrate/primitives/application-crypto/Cargo.toml b/substrate/primitives/application-crypto/Cargo.toml index 7a38b28e83..e13427d256 100644 --- a/substrate/primitives/application-crypto/Cargo.toml +++ b/substrate/primitives/application-crypto/Cargo.toml @@ -9,7 +9,7 @@ description = "Provides facilities for generating application specific crypto wr primitives = { package = "sp-core", path = "../core", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false } [dev-dependencies] @@ -18,7 +18,7 @@ sp-runtime = { path = "../../primitives/runtime" } [features] default = [ "std" ] -std = [ "full_crypto", "primitives/std", "codec/std", "serde", "rstd/std", "runtime-io/std" ] +std = [ "full_crypto", "primitives/std", "codec/std", "serde", "sp-std/std", "runtime-io/std" ] # This feature enables all crypto primitives for `no_std` builds like microcontrollers # or Intel SGX. diff --git a/substrate/primitives/application-crypto/src/ed25519.rs b/substrate/primitives/application-crypto/src/ed25519.rs index 7ada97672a..358e5f657e 100644 --- a/substrate/primitives/application-crypto/src/ed25519.rs +++ b/substrate/primitives/application-crypto/src/ed25519.rs @@ -18,7 +18,7 @@ use crate::{RuntimePublic, KeyTypeId}; -use rstd::vec::Vec; +use sp_std::vec::Vec; pub use primitives::ed25519::*; diff --git a/substrate/primitives/application-crypto/src/lib.rs b/substrate/primitives/application-crypto/src/lib.rs index 3a748e50c9..d7c303e338 100644 --- a/substrate/primitives/application-crypto/src/lib.rs +++ b/substrate/primitives/application-crypto/src/lib.rs @@ -33,7 +33,7 @@ pub use codec; #[cfg(feature = "std")] pub use serde; #[doc(hidden)] -pub use rstd::{ops::Deref, vec::Vec}; +pub use sp_std::{ops::Deref, vec::Vec}; pub mod ed25519; pub mod sr25519; @@ -102,7 +102,7 @@ macro_rules! app_crypto_pair { type Seed = <$pair as $crate::Pair>::Seed; type Signature = Signature; type DeriveError = <$pair as $crate::Pair>::DeriveError; - + #[cfg(feature = "std")] fn generate_with_phrase(password: Option<&str>) -> (Self, String, Self::Seed) { let r = <$pair>::generate_with_phrase(password); @@ -353,7 +353,7 @@ macro_rules! app_crypto_signature_not_full_crypto { )] pub struct Signature($sig); } - + impl $crate::CryptoType for Signature {} impl $crate::AppKey for Signature { diff --git a/substrate/primitives/application-crypto/src/sr25519.rs b/substrate/primitives/application-crypto/src/sr25519.rs index ebe2a5d353..749e3db21f 100644 --- a/substrate/primitives/application-crypto/src/sr25519.rs +++ b/substrate/primitives/application-crypto/src/sr25519.rs @@ -18,7 +18,7 @@ use crate::{RuntimePublic, KeyTypeId}; -use rstd::vec::Vec; +use sp_std::vec::Vec; pub use primitives::sr25519::*; diff --git a/substrate/primitives/application-crypto/src/traits.rs b/substrate/primitives/application-crypto/src/traits.rs index 0575d2ba06..741bbc48c9 100644 --- a/substrate/primitives/application-crypto/src/traits.rs +++ b/substrate/primitives/application-crypto/src/traits.rs @@ -19,7 +19,7 @@ use primitives::crypto::Pair; use codec::Codec; use primitives::crypto::{KeyTypeId, CryptoType, IsWrappedBy, Public}; -use rstd::{fmt::Debug, vec::Vec}; +use sp_std::{fmt::Debug, vec::Vec}; /// An application-specific key. pub trait AppKey: 'static + Send + Sync + Sized + CryptoType + Clone { @@ -42,9 +42,9 @@ pub trait AppKey: 'static + Send + Sync + Sized + CryptoType + Clone { /// Type which implements Hash in std, not when no-std (std variant). #[cfg(any(feature = "std", feature = "full_crypto"))] -pub trait MaybeHash: rstd::hash::Hash {} +pub trait MaybeHash: sp_std::hash::Hash {} #[cfg(any(feature = "std", feature = "full_crypto"))] -impl MaybeHash for T {} +impl MaybeHash for T {} /// Type which implements Hash in std, not when no-std (no-std variant). #[cfg(all(not(feature = "std"), not(feature = "full_crypto")))] @@ -54,9 +54,9 @@ impl MaybeHash for T {} /// Type which implements Debug and Hash in std, not when no-std (no-std variant with crypto). #[cfg(all(not(feature = "std"), feature = "full_crypto"))] -pub trait MaybeDebugHash: rstd::hash::Hash {} +pub trait MaybeDebugHash: sp_std::hash::Hash {} #[cfg(all(not(feature = "std"), feature = "full_crypto"))] -impl MaybeDebugHash for T {} +impl MaybeDebugHash for T {} /// A application's public key. pub trait AppPublic: diff --git a/substrate/primitives/authority-discovery/Cargo.toml b/substrate/primitives/authority-discovery/Cargo.toml index f96d4c8e48..1924add0a6 100644 --- a/substrate/primitives/authority-discovery/Cargo.toml +++ b/substrate/primitives/authority-discovery/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] app-crypto = { package = "sc-application-crypto", path = "../application-crypto", default-features = false } codec = { package = "parity-scale-codec", default-features = false, version = "1.0.3" } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } sp-api = { path = "../sr-api", default-features = false } sp-runtime = { path = "../runtime", default-features = false } @@ -17,7 +17,7 @@ default = ["std"] std = [ "app-crypto/std", "codec/std", - "rstd/std", + "sp-std/std", "sp-api/std", "sp-runtime/std" ] diff --git a/substrate/primitives/authority-discovery/src/lib.rs b/substrate/primitives/authority-discovery/src/lib.rs index 8ce9757a59..811bcc261b 100644 --- a/substrate/primitives/authority-discovery/src/lib.rs +++ b/substrate/primitives/authority-discovery/src/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::vec::Vec; +use sp_std::vec::Vec; mod app { use app_crypto::{app_crypto, key_types::AUTHORITY_DISCOVERY, sr25519}; diff --git a/substrate/primitives/authorship/Cargo.toml b/substrate/primitives/authorship/Cargo.toml index 26093b0136..f996a75aae 100644 --- a/substrate/primitives/authorship/Cargo.toml +++ b/substrate/primitives/authorship/Cargo.toml @@ -8,14 +8,14 @@ edition = "2018" [dependencies] sp-inherents = { path = "../inherents", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } [features] default = [ "std" ] std = [ "codec/std", - "rstd/std", + "sp-std/std", "sp-inherents/std", "sp-runtime/std", ] diff --git a/substrate/primitives/authorship/src/lib.rs b/substrate/primitives/authorship/src/lib.rs index c143e752b2..7494e58338 100644 --- a/substrate/primitives/authorship/src/lib.rs +++ b/substrate/primitives/authorship/src/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::{result::Result, prelude::*}; +use sp_std::{result::Result, prelude::*}; use codec::{Encode, Decode}; use sp_inherents::{Error, InherentIdentifier, InherentData, IsFatalError}; diff --git a/substrate/primitives/block-builder/runtime-api/Cargo.toml b/substrate/primitives/block-builder/runtime-api/Cargo.toml index 36ee35e3eb..ba6705fa2a 100644 --- a/substrate/primitives/block-builder/runtime-api/Cargo.toml +++ b/substrate/primitives/block-builder/runtime-api/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] sp-runtime = { path = "../../runtime", default-features = false } sp-api = { path = "../../sr-api", default-features = false } -rstd = { package = "sp-std", path = "../../sr-std", default-features = false } +sp-std = { path = "../../std", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false } inherents = { package = "sp-inherents", path = "../../inherents", default-features = false } @@ -18,5 +18,5 @@ std = [ "codec/std", "inherents/std", "sp-api/std", - "rstd/std", + "sp-std/std", ] diff --git a/substrate/primitives/block-builder/runtime-api/src/lib.rs b/substrate/primitives/block-builder/runtime-api/src/lib.rs index 441df3dd4a..3b0a615ae5 100644 --- a/substrate/primitives/block-builder/runtime-api/src/lib.rs +++ b/substrate/primitives/block-builder/runtime-api/src/lib.rs @@ -64,7 +64,7 @@ sp_api::decl_runtime_apis! { /// Generate inherent extrinsics. The inherent data will vary from chain to chain. fn inherent_extrinsics( inherent: InherentData, - ) -> rstd::vec::Vec<::Extrinsic>; + ) -> sp_std::vec::Vec<::Extrinsic>; /// Check that the inherents are valid. The inherent data will vary from chain to chain. fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult; /// Generate a random seed. diff --git a/substrate/primitives/consensus/aura/Cargo.toml b/substrate/primitives/consensus/aura/Cargo.toml index 4bc83206a2..ef0af6d292 100644 --- a/substrate/primitives/consensus/aura/Cargo.toml +++ b/substrate/primitives/consensus/aura/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] app-crypto = { package = "sc-application-crypto", path = "../../application-crypto", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } -rstd = { package = "sp-std", path = "../../sr-std", default-features = false } +sp-std = { path = "../../std", default-features = false } sp-api = { path = "../../sr-api", default-features = false } sp-runtime = { path = "../../runtime", default-features = false } inherents = { package = "sp-inherents", path = "../../inherents", default-features = false } @@ -19,7 +19,7 @@ default = ["std"] std = [ "app-crypto/std", "codec/std", - "rstd/std", + "sp-std/std", "sp-api/std", "sp-runtime/std", "inherents/std", diff --git a/substrate/primitives/consensus/aura/src/inherents.rs b/substrate/primitives/consensus/aura/src/inherents.rs index 11a429b817..5899e7b272 100644 --- a/substrate/primitives/consensus/aura/src/inherents.rs +++ b/substrate/primitives/consensus/aura/src/inherents.rs @@ -18,7 +18,7 @@ use sp_timestamp::TimestampInherentData; use inherents::{InherentIdentifier, InherentData, Error}; -use rstd::result::Result; +use sp_std::result::Result; use codec::Decode; #[cfg(feature = "std")] diff --git a/substrate/primitives/consensus/aura/src/lib.rs b/substrate/primitives/consensus/aura/src/lib.rs index c866c041da..1ed1da96ec 100644 --- a/substrate/primitives/consensus/aura/src/lib.rs +++ b/substrate/primitives/consensus/aura/src/lib.rs @@ -19,7 +19,7 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::{Encode, Decode, Codec}; -use rstd::vec::Vec; +use sp_std::vec::Vec; use sp_runtime::ConsensusEngineId; pub mod inherents; diff --git a/substrate/primitives/consensus/babe/Cargo.toml b/substrate/primitives/consensus/babe/Cargo.toml index d4d867c373..a77813aee9 100644 --- a/substrate/primitives/consensus/babe/Cargo.toml +++ b/substrate/primitives/consensus/babe/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] app-crypto = { package = "sc-application-crypto", path = "../../application-crypto", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } -rstd = { package = "sp-std", path = "../../sr-std", default-features = false } +sp-std = { path = "../../std", default-features = false } schnorrkel = { version = "0.8.5", features = ["preaudit_deprecated"], optional = true } sp-api = { path = "../../sr-api", default-features = false } sp-consensus = { path = "../common", optional = true } @@ -21,7 +21,7 @@ default = ["std"] std = [ "app-crypto/std", "codec/std", - "rstd/std", + "sp-std/std", "schnorrkel", "sp-api/std", "sp-consensus", diff --git a/substrate/primitives/consensus/babe/src/digest.rs b/substrate/primitives/consensus/babe/src/digest.rs index 496c348e1d..343cec4db7 100644 --- a/substrate/primitives/consensus/babe/src/digest.rs +++ b/substrate/primitives/consensus/babe/src/digest.rs @@ -33,7 +33,7 @@ use schnorrkel::{ SignatureError, errors::MultiSignatureStage, vrf::{VRFProof, VRFOutput, VRF_OUTPUT_LENGTH, VRF_PROOF_LENGTH} }; -use rstd::vec::Vec; +use sp_std::vec::Vec; /// A BABE pre-runtime digest. This contains all data required to validate a diff --git a/substrate/primitives/consensus/babe/src/inherents.rs b/substrate/primitives/consensus/babe/src/inherents.rs index 0ebefaaaf0..5a4e042352 100644 --- a/substrate/primitives/consensus/babe/src/inherents.rs +++ b/substrate/primitives/consensus/babe/src/inherents.rs @@ -23,7 +23,7 @@ use sp_timestamp::TimestampInherentData; #[cfg(feature = "std")] use codec::Decode; -use rstd::result::Result; +use sp_std::result::Result; /// The BABE inherent identifier. pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"babeslot"; diff --git a/substrate/primitives/consensus/babe/src/lib.rs b/substrate/primitives/consensus/babe/src/lib.rs index 552b841733..90e8855b57 100644 --- a/substrate/primitives/consensus/babe/src/lib.rs +++ b/substrate/primitives/consensus/babe/src/lib.rs @@ -23,7 +23,7 @@ mod digest; pub mod inherents; use codec::{Encode, Decode}; -use rstd::vec::Vec; +use sp_std::vec::Vec; use sp_runtime::{ConsensusEngineId, RuntimeDebug}; #[cfg(feature = "std")] diff --git a/substrate/primitives/consensus/common/Cargo.toml b/substrate/primitives/consensus/common/Cargo.toml index 75a62ead0f..ea2ee3891c 100644 --- a/substrate/primitives/consensus/common/Cargo.toml +++ b/substrate/primitives/consensus/common/Cargo.toml @@ -13,7 +13,7 @@ primitives = { package = "sp-core", path= "../../core" } inherents = { package = "sp-inherents", path = "../../inherents" } futures = { version = "0.3.1", features = ["thread-pool"] } futures-timer = "0.4.0" -rstd = { package = "sp-std", path = "../../sr-std" } +sp-std = { path = "../../std" } runtime_version = { package = "sp-version", path = "../../sr-version" } sp-runtime = { path = "../../runtime" } codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } diff --git a/substrate/primitives/consensus/pow/Cargo.toml b/substrate/primitives/consensus/pow/Cargo.toml index ef64333e29..dfe646c00d 100644 --- a/substrate/primitives/consensus/pow/Cargo.toml +++ b/substrate/primitives/consensus/pow/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] sp-api = { path = "../../sr-api", default-features = false } -rstd = { package = "sp-std", path = "../../sr-std", default-features = false } +sp-std = { path = "../../std", default-features = false } sp-runtime = { path = "../../runtime", default-features = false } primitives = { package = "sp-core", path = "../../core", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } @@ -15,7 +15,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", default-features = [features] default = ["std"] std = [ - "rstd/std", + "sp-std/std", "sp-api/std", "sp-runtime/std", "primitives/std", diff --git a/substrate/primitives/consensus/pow/src/lib.rs b/substrate/primitives/consensus/pow/src/lib.rs index 69e088bd9c..005e2f5325 100644 --- a/substrate/primitives/consensus/pow/src/lib.rs +++ b/substrate/primitives/consensus/pow/src/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::vec::Vec; +use sp_std::vec::Vec; use sp_runtime::ConsensusEngineId; use codec::Decode; diff --git a/substrate/primitives/core/Cargo.toml b/substrate/primitives/core/Cargo.toml index d3a8ee8b1b..d8e2513879 100644 --- a/substrate/primitives/core/Cargo.toml +++ b/substrate/primitives/core/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } rustc-hex = { version = "2.0.1", default-features = false } log = { version = "0.4.8", default-features = false } @@ -73,7 +73,7 @@ std = [ "codec/std", "hash256-std-hasher/std", "hash-db/std", - "rstd/std", + "sp-std/std", "serde", "rustc-hex/std", "twox-hash/std", diff --git a/substrate/primitives/core/src/changes_trie.rs b/substrate/primitives/core/src/changes_trie.rs index 5e88485a03..f746e1dc8d 100644 --- a/substrate/primitives/core/src/changes_trie.rs +++ b/substrate/primitives/core/src/changes_trie.rs @@ -57,8 +57,8 @@ impl ChangesTrieConfiguration { ) -> bool where Number: From + PartialEq + - ::rstd::ops::Rem + ::rstd::ops::Sub + - ::rstd::cmp::PartialOrd + Zero, + ::sp_std::ops::Rem + ::sp_std::ops::Sub + + ::sp_std::cmp::PartialOrd + Zero, { block > zero && self.is_digest_build_enabled() @@ -92,8 +92,8 @@ impl ChangesTrieConfiguration { ) -> Option where Number: Clone + From + PartialOrd + PartialEq + - ::rstd::ops::Add + ::rstd::ops::Sub + - ::rstd::ops::Div + ::rstd::ops::Mul + Zero, + ::sp_std::ops::Add + ::sp_std::ops::Sub + + ::sp_std::ops::Div + ::sp_std::ops::Mul + Zero, { if block <= zero { return None; @@ -126,8 +126,8 @@ impl ChangesTrieConfiguration { ) -> Option<(Number, Number)> where Number: Clone + From + PartialOrd + PartialEq + - ::rstd::ops::Add + ::rstd::ops::Sub + - ::rstd::ops::Div + ::rstd::ops::Mul, + ::sp_std::ops::Add + ::sp_std::ops::Sub + + ::sp_std::ops::Div + ::sp_std::ops::Mul, { if !self.is_digest_build_enabled() { return None; @@ -160,8 +160,8 @@ impl ChangesTrieConfiguration { pub fn digest_level_at_block(&self, zero: Number, block: Number) -> Option<(u32, u32, u32)> where Number: Clone + From + PartialEq + - ::rstd::ops::Rem + ::rstd::ops::Sub + - ::rstd::cmp::PartialOrd + Zero, + ::sp_std::ops::Rem + ::sp_std::ops::Sub + + ::sp_std::cmp::PartialOrd + Zero, { if !self.is_digest_build_required_at_block(zero.clone(), block.clone()) { return None; diff --git a/substrate/primitives/core/src/crypto.rs b/substrate/primitives/core/src/crypto.rs index f5484efed7..3d020bcde0 100644 --- a/substrate/primitives/core/src/crypto.rs +++ b/substrate/primitives/core/src/crypto.rs @@ -18,10 +18,10 @@ //! Cryptographic utilities. // end::description[] -use rstd::{vec::Vec, hash::Hash}; +use sp_std::{vec::Vec, hash::Hash}; #[cfg(feature = "std")] -use rstd::convert::TryInto; -use rstd::convert::TryFrom; +use sp_std::convert::TryInto; +use sp_std::convert::TryFrom; #[cfg(feature = "std")] use parking_lot::Mutex; #[cfg(feature = "std")] @@ -34,7 +34,7 @@ use base58::{FromBase58, ToBase58}; use zeroize::Zeroize; #[doc(hidden)] -pub use rstd::ops::Deref; +pub use sp_std::ops::Deref; use runtime_interface::pass_by::PassByInner; /// The root phrase for our publicly known keys. @@ -86,7 +86,7 @@ impl AsRef for Protected { } } -impl rstd::ops::Deref for Protected { +impl sp_std::ops::Deref for Protected { type Target = T; fn deref(&self) -> &T { @@ -552,7 +552,7 @@ impl From<[u8; 32]> for AccountId32 { } } -impl<'a> rstd::convert::TryFrom<&'a [u8]> for AccountId32 { +impl<'a> sp_std::convert::TryFrom<&'a [u8]> for AccountId32 { type Error = (); fn try_from(x: &'a [u8]) -> Result { if x.len() == 32 { @@ -578,15 +578,15 @@ impl std::fmt::Display for AccountId32 { } } -impl rstd::fmt::Debug for AccountId32 { +impl sp_std::fmt::Debug for AccountId32 { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { let s = self.to_ss58check(); write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8]) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -625,7 +625,7 @@ mod dummy { fn as_mut(&mut self) -> &mut[u8] { unsafe { #[allow(mutable_transmutes)] - rstd::mem::transmute::<_, &'static mut [u8]>(&b""[..]) + sp_std::mem::transmute::<_, &'static mut [u8]>(&b""[..]) } } } @@ -772,8 +772,8 @@ pub trait Pair: CryptoType + Sized + Clone + Send + Sync + 'static { /// /// `None` is returned if no matches are found. #[cfg(feature = "std")] - fn from_string_with_seed(s: &str, password_override: Option<&str>) - -> Result<(Self, Option), SecretStringError> + fn from_string_with_seed(s: &str, password_override: Option<&str>) + -> Result<(Self, Option), SecretStringError> { let re = Regex::new(r"^(?P[\d\w ]+)?(?P(//?[^/]+)*)(///(?P.*))?$") .expect("constructed from known-good static value; qed"); diff --git a/substrate/primitives/core/src/ecdsa.rs b/substrate/primitives/core/src/ecdsa.rs index 50ad9ddfa0..e097d0c5e6 100644 --- a/substrate/primitives/core/src/ecdsa.rs +++ b/substrate/primitives/core/src/ecdsa.rs @@ -19,9 +19,9 @@ // end::description[] #[cfg(feature = "full_crypto")] -use rstd::vec::Vec; +use sp_std::vec::Vec; -use rstd::cmp::Ordering; +use sp_std::cmp::Ordering; use codec::{Encode, Decode}; #[cfg(feature = "full_crypto")] @@ -102,7 +102,7 @@ impl AsMut<[u8]> for Public { } } -impl rstd::convert::TryFrom<&[u8]> for Public { +impl sp_std::convert::TryFrom<&[u8]> for Public { type Error = (); fn try_from(data: &[u8]) -> Result { @@ -166,8 +166,8 @@ impl<'de> Deserialize<'de> for Public { } #[cfg(feature = "full_crypto")] -impl rstd::hash::Hash for Public { - fn hash(&self, state: &mut H) { +impl sp_std::hash::Hash for Public { + fn hash(&self, state: &mut H) { self.0.hash(state); } } @@ -176,7 +176,7 @@ impl rstd::hash::Hash for Public { #[derive(Encode, Decode)] pub struct Signature([u8; 65]); -impl rstd::convert::TryFrom<&[u8]> for Signature { +impl sp_std::convert::TryFrom<&[u8]> for Signature { type Error = (); fn try_from(data: &[u8]) -> Result { @@ -261,9 +261,9 @@ impl std::fmt::Debug for Signature { } #[cfg(feature = "full_crypto")] -impl rstd::hash::Hash for Signature { - fn hash(&self, state: &mut H) { - rstd::hash::Hash::hash(&self.0[..], state); +impl sp_std::hash::Hash for Signature { + fn hash(&self, state: &mut H) { + sp_std::hash::Hash::hash(&self.0[..], state); } } diff --git a/substrate/primitives/core/src/ed25519.rs b/substrate/primitives/core/src/ed25519.rs index 34ec0d6c8d..0b40ea8bb6 100644 --- a/substrate/primitives/core/src/ed25519.rs +++ b/substrate/primitives/core/src/ed25519.rs @@ -19,7 +19,7 @@ // end::description[] #[cfg(feature = "full_crypto")] -use rstd::vec::Vec; +use sp_std::vec::Vec; use crate::{hash::H256, hash::H512}; use codec::{Encode, Decode}; @@ -40,7 +40,7 @@ use crate::crypto::Ss58Codec; use serde::{de, Serializer, Serialize, Deserializer, Deserialize}; use crate::{crypto::{Public as TraitPublic, UncheckedFrom, CryptoType, Derive}}; use runtime_interface::pass_by::PassByInner; -use rstd::ops::Deref; +use sp_std::ops::Deref; /// A secret seed. It's not called a "secret key" because ring doesn't expose the secret keys /// of the key pair (yeah, dumb); as such we're forced to remember the seed manually if we @@ -94,7 +94,7 @@ impl Deref for Public { } } -impl rstd::convert::TryFrom<&[u8]> for Public { +impl sp_std::convert::TryFrom<&[u8]> for Public { type Error = (); fn try_from(data: &[u8]) -> Result { @@ -155,15 +155,15 @@ impl std::fmt::Display for Public { } } -impl rstd::fmt::Debug for Public { +impl sp_std::fmt::Debug for Public { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { let s = self.to_ss58check(); write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8]) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -187,7 +187,7 @@ impl<'de> Deserialize<'de> for Public { #[derive(Encode, Decode, PassByInner)] pub struct Signature(pub [u8; 64]); -impl rstd::convert::TryFrom<&[u8]> for Signature { +impl sp_std::convert::TryFrom<&[u8]> for Signature { type Error = (); fn try_from(data: &[u8]) -> Result { @@ -270,22 +270,22 @@ impl AsMut<[u8]> for Signature { } } -impl rstd::fmt::Debug for Signature { +impl sp_std::fmt::Debug for Signature { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "{}", crate::hexdisplay::HexDisplay::from(&self.0)) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } #[cfg(feature = "full_crypto")] -impl rstd::hash::Hash for Signature { - fn hash(&self, state: &mut H) { - rstd::hash::Hash::hash(&self.0[..], state); +impl sp_std::hash::Hash for Signature { + fn hash(&self, state: &mut H) { + sp_std::hash::Hash::hash(&self.0[..], state); } } diff --git a/substrate/primitives/core/src/hexdisplay.rs b/substrate/primitives/core/src/hexdisplay.rs index 2c8533e25b..104aaf812e 100644 --- a/substrate/primitives/core/src/hexdisplay.rs +++ b/substrate/primitives/core/src/hexdisplay.rs @@ -24,8 +24,8 @@ impl<'a> HexDisplay<'a> { pub fn from(d: &'a R) -> Self { HexDisplay(d.as_bytes_ref()) } } -impl<'a> rstd::fmt::Display for HexDisplay<'a> { - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> Result<(), rstd::fmt::Error> { +impl<'a> sp_std::fmt::Display for HexDisplay<'a> { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> Result<(), sp_std::fmt::Error> { if self.0.len() < 1027 { for byte in self.0 { f.write_fmt(format_args!("{:02x}", byte))?; @@ -43,8 +43,8 @@ impl<'a> rstd::fmt::Display for HexDisplay<'a> { } } -impl<'a> rstd::fmt::Debug for HexDisplay<'a> { - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> Result<(), rstd::fmt::Error> { +impl<'a> sp_std::fmt::Debug for HexDisplay<'a> { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> Result<(), sp_std::fmt::Error> { for byte in self.0 { f.write_fmt(format_args!("{:02x}", byte))?; } diff --git a/substrate/primitives/core/src/lib.rs b/substrate/primitives/core/src/lib.rs index 902cd55b58..888f401243 100644 --- a/substrate/primitives/core/src/lib.rs +++ b/substrate/primitives/core/src/lib.rs @@ -31,8 +31,8 @@ macro_rules! map { ); } -use rstd::prelude::*; -use rstd::ops::Deref; +use sp_std::prelude::*; +use sp_std::ops::Deref; #[cfg(feature = "std")] use std::borrow::Cow; #[cfg(feature = "std")] @@ -87,7 +87,7 @@ pub use self::hasher::blake2::Blake2Hasher; pub use primitives_storage as storage; #[doc(hidden)] -pub use rstd; +pub use sp_std; /// Context for executing a call into the runtime. pub enum ExecutionContext { @@ -147,7 +147,7 @@ impl OpaqueMetadata { } } -impl rstd::ops::Deref for OpaqueMetadata { +impl sp_std::ops::Deref for OpaqueMetadata { type Target = Vec; fn deref(&self) -> &Self::Target { @@ -165,8 +165,8 @@ pub enum NativeOrEncoded { } #[cfg(feature = "std")] -impl rstd::fmt::Debug for NativeOrEncoded { - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { +impl sp_std::fmt::Debug for NativeOrEncoded { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { hexdisplay::HexDisplay::from(&self.as_encoded().as_ref()).fmt(f) } } @@ -305,7 +305,7 @@ pub fn to_substrate_wasm_fn_return_value(value: &impl Encode) -> u64 { // Leak the output vector to avoid it being freed. // This is fine in a WASM context since the heap // will be discarded after the call. - rstd::mem::forget(encoded); + sp_std::mem::forget(encoded); res } diff --git a/substrate/primitives/core/src/offchain/mod.rs b/substrate/primitives/core/src/offchain/mod.rs index 8afabc0392..4b7423c253 100644 --- a/substrate/primitives/core/src/offchain/mod.rs +++ b/substrate/primitives/core/src/offchain/mod.rs @@ -17,7 +17,7 @@ //! Offchain workers types use codec::{Encode, Decode}; -use rstd::{prelude::{Vec, Box}, convert::TryFrom}; +use sp_std::{prelude::{Vec, Box}, convert::TryFrom}; use crate::RuntimeDebug; use runtime_interface::pass_by::{PassByCodec, PassByInner, PassByEnum}; diff --git a/substrate/primitives/core/src/sandbox.rs b/substrate/primitives/core/src/sandbox.rs index dd91ad6a1f..cc82b4bd4c 100644 --- a/substrate/primitives/core/src/sandbox.rs +++ b/substrate/primitives/core/src/sandbox.rs @@ -17,7 +17,7 @@ //! Definition of a sandbox environment. use codec::{Encode, Decode}; -use rstd::vec::Vec; +use sp_std::vec::Vec; /// Error error that can be returned from host function. #[derive(Encode, Decode)] diff --git a/substrate/primitives/core/src/sr25519.rs b/substrate/primitives/core/src/sr25519.rs index 9521e3bb6c..05b128d288 100644 --- a/substrate/primitives/core/src/sr25519.rs +++ b/substrate/primitives/core/src/sr25519.rs @@ -21,7 +21,7 @@ //! for this to work. // end::description[] #[cfg(feature = "full_crypto")] -use rstd::vec::Vec; +use sp_std::vec::Vec; #[cfg(feature = "full_crypto")] use schnorrkel::{signing_context, ExpansionMode, Keypair, SecretKey, MiniSecretKey, PublicKey, derive::{Derivation, ChainCode, CHAIN_CODE_LENGTH} @@ -42,7 +42,7 @@ use crate::crypto::Ss58Codec; use crate::{crypto::{Public as TraitPublic, UncheckedFrom, CryptoType, Derive}}; use crate::hash::{H256, H512}; use codec::{Encode, Decode}; -use rstd::ops::Deref; +use sp_std::ops::Deref; #[cfg(feature = "std")] use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; @@ -121,7 +121,7 @@ impl std::str::FromStr for Public { } } -impl rstd::convert::TryFrom<&[u8]> for Public { +impl sp_std::convert::TryFrom<&[u8]> for Public { type Error = (); fn try_from(data: &[u8]) -> Result { @@ -154,15 +154,15 @@ impl std::fmt::Display for Public { } } -impl rstd::fmt::Debug for Public { +impl sp_std::fmt::Debug for Public { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { let s = self.to_ss58check(); write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8]) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } @@ -188,7 +188,7 @@ impl<'de> Deserialize<'de> for Public { #[derive(Encode, Decode, PassByInner)] pub struct Signature(pub [u8; 64]); -impl rstd::convert::TryFrom<&[u8]> for Signature { +impl sp_std::convert::TryFrom<&[u8]> for Signature { type Error = (); fn try_from(data: &[u8]) -> Result { @@ -278,22 +278,22 @@ impl From for Signature { } } -impl rstd::fmt::Debug for Signature { +impl sp_std::fmt::Debug for Signature { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "{}", crate::hexdisplay::HexDisplay::from(&self.0)) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } #[cfg(feature = "full_crypto")] -impl rstd::hash::Hash for Signature { - fn hash(&self, state: &mut H) { - rstd::hash::Hash::hash(&self.0[..], state); +impl sp_std::hash::Hash for Signature { + fn hash(&self, state: &mut H) { + sp_std::hash::Hash::hash(&self.0[..], state); } } diff --git a/substrate/primitives/core/src/testing.rs b/substrate/primitives/core/src/testing.rs index c87c170d20..b5a8c0aad6 100644 --- a/substrate/primitives/core/src/testing.rs +++ b/substrate/primitives/core/src/testing.rs @@ -184,7 +184,7 @@ macro_rules! wasm_export_functions { &[0u8; 0] } else { unsafe { - $crate::rstd::slice::from_raw_parts(input_data, input_len) + $crate::sp_std::slice::from_raw_parts(input_data, input_len) } }; @@ -212,7 +212,7 @@ macro_rules! wasm_export_functions { &[0u8; 0] } else { unsafe { - $crate::rstd::slice::from_raw_parts(input_data, input_len) + $crate::sp_std::slice::from_raw_parts(input_data, input_len) } }; diff --git a/substrate/primitives/core/storage/Cargo.toml b/substrate/primitives/core/storage/Cargo.toml index 243184d038..d124dd47e1 100644 --- a/substrate/primitives/core/storage/Cargo.toml +++ b/substrate/primitives/core/storage/Cargo.toml @@ -6,11 +6,11 @@ edition = "2018" description = "Storage related primitives" [dependencies] -rstd = { package = "sp-std", path = "../../sr-std", default-features = false } +sp-std = { path = "../../std", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } impl-serde = { version = "0.2.3", optional = true } sp-debug-derive = { version = "2.0.0", path = "../debug-derive" } [features] default = [ "std" ] -std = [ "rstd/std", "serde", "impl-serde" ] +std = [ "sp-std/std", "serde", "impl-serde" ] diff --git a/substrate/primitives/core/storage/src/lib.rs b/substrate/primitives/core/storage/src/lib.rs index 3fd883788c..9d10d692e5 100644 --- a/substrate/primitives/core/storage/src/lib.rs +++ b/substrate/primitives/core/storage/src/lib.rs @@ -22,7 +22,7 @@ use serde::{Serialize, Deserialize}; use sp_debug_derive::RuntimeDebug; -use rstd::{vec::Vec, borrow::Cow}; +use sp_std::{vec::Vec, borrow::Cow}; /// Storage key. #[derive(PartialEq, Eq, RuntimeDebug)] diff --git a/substrate/primitives/externalities/Cargo.toml b/substrate/primitives/externalities/Cargo.toml index 5b5e8c1ee8..8a89a0be08 100644 --- a/substrate/primitives/externalities/Cargo.toml +++ b/substrate/primitives/externalities/Cargo.toml @@ -7,5 +7,5 @@ edition = "2018" [dependencies] primitives-storage = { package = "sp-core-storage", path = "../core/storage" } -rstd = { package = "sp-std", path = "../sr-std" } +sp-std = { path = "../std" } environmental = { version = "1.0.2" } diff --git a/substrate/primitives/finality-grandpa/Cargo.toml b/substrate/primitives/finality-grandpa/Cargo.toml index 78f28b7591..d12b2d9bbf 100644 --- a/substrate/primitives/finality-grandpa/Cargo.toml +++ b/substrate/primitives/finality-grandpa/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] app-crypto = { package = "sc-application-crypto", path = "../application-crypto", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-api = { path = "../sr-api", default-features = false } sp-runtime = { path = "../runtime", default-features = false } @@ -17,7 +17,7 @@ default = ["std"] std = [ "app-crypto/std", "codec/std", - "rstd/std", + "sp-std/std", "serde", "sp-api/std", "sp-runtime/std", diff --git a/substrate/primitives/finality-grandpa/src/lib.rs b/substrate/primitives/finality-grandpa/src/lib.rs index 0e7ed9926f..ef61092b9c 100644 --- a/substrate/primitives/finality-grandpa/src/lib.rs +++ b/substrate/primitives/finality-grandpa/src/lib.rs @@ -25,8 +25,8 @@ extern crate alloc; use serde::Serialize; use codec::{Encode, Decode, Input, Codec}; use sp_runtime::{ConsensusEngineId, RuntimeDebug}; -use rstd::borrow::Cow; -use rstd::vec::Vec; +use sp_std::borrow::Cow; +use sp_std::vec::Vec; mod app { use app_crypto::{app_crypto, key_types::GRANDPA, ed25519}; diff --git a/substrate/primitives/finality-tracker/Cargo.toml b/substrate/primitives/finality-tracker/Cargo.toml index 812596beaa..919fc0bab4 100644 --- a/substrate/primitives/finality-tracker/Cargo.toml +++ b/substrate/primitives/finality-tracker/Cargo.toml @@ -7,12 +7,12 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } inherents = { package = "sp-inherents", path = "../../primitives/inherents", default-features = false } -rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false } +sp-std = { path = "../../primitives/std", default-features = false } [features] default = ["std"] std = [ "codec/std", - "rstd/std", + "sp-std/std", "inherents/std", ] diff --git a/substrate/primitives/inherents/Cargo.toml b/substrate/primitives/inherents/Cargo.toml index 0d33b961ed..d8f67031f9 100644 --- a/substrate/primitives/inherents/Cargo.toml +++ b/substrate/primitives/inherents/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] parking_lot = { version = "0.9.0", optional = true } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } primitives = { package = "sp-core", path = "../core", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] } derive_more = { version = "0.99.2", optional = true } @@ -15,7 +15,7 @@ derive_more = { version = "0.99.2", optional = true } default = [ "std" ] std = [ "parking_lot", - "rstd/std", + "sp-std/std", "codec/std", "primitives/std", "derive_more", diff --git a/substrate/primitives/inherents/src/lib.rs b/substrate/primitives/inherents/src/lib.rs index b398e43997..8f26a50822 100644 --- a/substrate/primitives/inherents/src/lib.rs +++ b/substrate/primitives/inherents/src/lib.rs @@ -35,7 +35,7 @@ use codec::{Encode, Decode}; -use rstd::{collections::btree_map::{BTreeMap, IntoIter, Entry}, vec::Vec}; +use sp_std::{collections::btree_map::{BTreeMap, IntoIter, Entry}, vec::Vec}; #[cfg(feature = "std")] use parking_lot::RwLock; diff --git a/substrate/primitives/phragmen/Cargo.toml b/substrate/primitives/phragmen/Cargo.toml index 06071c79db..656ce8b9b2 100644 --- a/substrate/primitives/phragmen/Cargo.toml +++ b/substrate/primitives/phragmen/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } sp-runtime = { path = "../../primitives/runtime", default-features = false } [dev-dependencies] @@ -18,6 +18,6 @@ rand = "0.7.2" default = ["std"] std = [ "serde", - "rstd/std", + "sp-std/std", "sp-runtime/std", ] diff --git a/substrate/primitives/phragmen/src/lib.rs b/substrate/primitives/phragmen/src/lib.rs index c5e9d97fc7..a06ef9497b 100644 --- a/substrate/primitives/phragmen/src/lib.rs +++ b/substrate/primitives/phragmen/src/lib.rs @@ -33,7 +33,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::{prelude::*, collections::btree_map::BTreeMap}; +use sp_std::{prelude::*, collections::btree_map::BTreeMap}; use sp_runtime::RuntimeDebug; use sp_runtime::{helpers_128bit::multiply_by_rational, Perbill, Rational128}; use sp_runtime::traits::{Zero, Convert, Member, SimpleArithmetic, Saturating, Bounded}; diff --git a/substrate/primitives/phragmen/src/mock.rs b/substrate/primitives/phragmen/src/mock.rs index edb0826b06..3074258bbb 100644 --- a/substrate/primitives/phragmen/src/mock.rs +++ b/substrate/primitives/phragmen/src/mock.rs @@ -23,7 +23,7 @@ use sp_runtime::{ assert_eq_error_rate, Perbill, traits::{Convert, Member, SaturatedConversion} }; -use rstd::collections::btree_map::BTreeMap; +use sp_std::collections::btree_map::BTreeMap; pub(crate) struct TestCurrencyToVote; impl Convert for TestCurrencyToVote { @@ -149,7 +149,7 @@ pub(crate) fn elect_float( if let Some(winner) = candidates .iter_mut() .filter(|c| !c.elected) - .min_by(|x, y| x.score.partial_cmp(&y.score).unwrap_or(rstd::cmp::Ordering::Equal)) + .min_by(|x, y| x.score.partial_cmp(&y.score).unwrap_or(sp_std::cmp::Ordering::Equal)) { winner.elected = true; for n in &mut voters { @@ -250,10 +250,10 @@ pub(crate) fn do_equalize_float( if backing_backed_stake.len() > 0 { let max_stake = backing_backed_stake .iter() - .max_by(|x, y| x.partial_cmp(&y).unwrap_or(rstd::cmp::Ordering::Equal)) + .max_by(|x, y| x.partial_cmp(&y).unwrap_or(sp_std::cmp::Ordering::Equal)) .expect("vector with positive length will have a max; qed"); let min_stake = backed_stakes_iter - .min_by(|x, y| x.partial_cmp(&y).unwrap_or(rstd::cmp::Ordering::Equal)) + .min_by(|x, y| x.partial_cmp(&y).unwrap_or(sp_std::cmp::Ordering::Equal)) .expect("iterator with positive length will have a min; qed"); difference = max_stake - min_stake; @@ -277,7 +277,7 @@ pub(crate) fn do_equalize_float( elected_edges.sort_unstable_by(|x, y| support_map.get(&x.0) .and_then(|x| support_map.get(&y.0).and_then(|y| x.total.partial_cmp(&y.total))) - .unwrap_or(rstd::cmp::Ordering::Equal) + .unwrap_or(sp_std::cmp::Ordering::Equal) ); let mut cumulative_stake = 0.0; diff --git a/substrate/primitives/runtime-interface/Cargo.toml b/substrate/primitives/runtime-interface/Cargo.toml index e904633565..af0ca7a5f6 100644 --- a/substrate/primitives/runtime-interface/Cargo.toml +++ b/substrate/primitives/runtime-interface/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] wasm-interface = { package = "sp-wasm-interface", path = "../wasm-interface", optional = true } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } sp-runtime-interface-proc-macro = { path = "proc-macro" } externalities = { package = "sp-externalities", path = "../externalities", optional = true } codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false } @@ -25,7 +25,7 @@ runtime-io = { package = "sp-io", path = "../sr-io" } default = [ "std" ] std = [ "wasm-interface", - "rstd/std", + "sp-std/std", "codec/std", "externalities", "environmental", 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 ac5e675520..c650a8cb5c 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 @@ -50,10 +50,10 @@ pub fn derive_impl(input: DeriveInput) -> Result { type PassBy = #crate_::pass_by::Enum<#ident>; } - impl #crate_::rstd::convert::TryFrom for #ident { + impl #crate_::sp_std::convert::TryFrom for #ident { type Error = (); - fn try_from(inner: u8) -> #crate_::rstd::result::Result { + fn try_from(inner: u8) -> #crate_::sp_std::result::Result { match inner { #( #try_from_variants, )* _ => Err(()), diff --git a/substrate/primitives/runtime-interface/src/impls.rs b/substrate/primitives/runtime-interface/src/impls.rs index c2821ce6ec..0410d15321 100644 --- a/substrate/primitives/runtime-interface/src/impls.rs +++ b/substrate/primitives/runtime-interface/src/impls.rs @@ -30,13 +30,13 @@ use wasm_interface::{FunctionContext, Result}; use codec::{Encode, Decode}; -use rstd::{any::TypeId, mem, vec::Vec}; +use sp_std::{any::TypeId, mem, vec::Vec}; #[cfg(feature = "std")] -use rstd::borrow::Cow; +use sp_std::borrow::Cow; #[cfg(not(feature = "std"))] -use rstd::{slice, boxed::Box}; +use sp_std::{slice, boxed::Box}; // Make sure that our assumptions for storing a pointer + its size in `u64` is valid. #[cfg(all(not(feature = "std"), not(feature = "disable_target_static_assertions")))] @@ -48,7 +48,7 @@ assert_eq_size!(*const u8, u32); pub fn pointer_and_len_to_u64(ptr: u32, len: u32) -> u64 { // The static assertions from above are changed into a runtime check. #[cfg(all(not(feature = "std"), feature = "disable_target_static_assertions"))] - assert_eq!(4, rstd::mem::size_of::()); + assert_eq!(4, sp_std::mem::size_of::()); (u64::from(len) << 32) | u64::from(ptr) } @@ -57,7 +57,7 @@ pub fn pointer_and_len_to_u64(ptr: u32, len: u32) -> u64 { pub fn pointer_and_len_from_u64(val: u64) -> (u32, u32) { // The static assertions from above are changed into a runtime check. #[cfg(all(not(feature = "std"), feature = "disable_target_static_assertions"))] - assert_eq!(4, rstd::mem::size_of::()); + assert_eq!(4, sp_std::mem::size_of::()); let ptr = (val & (!0u32 as u64)) as u32; let len = (val >> 32) as u32; @@ -373,7 +373,7 @@ impl_traits_for_arrays! { 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, } -impl PassBy for rstd::result::Result { +impl PassBy for sp_std::result::Result { type PassBy = Codec; } diff --git a/substrate/primitives/runtime-interface/src/lib.rs b/substrate/primitives/runtime-interface/src/lib.rs index c6b006f4e6..bce5dbfec2 100644 --- a/substrate/primitives/runtime-interface/src/lib.rs +++ b/substrate/primitives/runtime-interface/src/lib.rs @@ -77,7 +77,7 @@ pub use wasm_interface; #[doc(hidden)] -pub use rstd; +pub use sp_std; pub use sp_runtime_interface_proc_macro::runtime_interface; diff --git a/substrate/primitives/runtime-interface/src/pass_by.rs b/substrate/primitives/runtime-interface/src/pass_by.rs index 3fcf04b1c4..96cd6314ba 100644 --- a/substrate/primitives/runtime-interface/src/pass_by.rs +++ b/substrate/primitives/runtime-interface/src/pass_by.rs @@ -30,10 +30,10 @@ use crate::wasm::*; #[cfg(feature = "std")] use wasm_interface::{FunctionContext, Pointer, Result}; -use rstd::{marker::PhantomData, convert::TryFrom}; +use sp_std::{marker::PhantomData, convert::TryFrom}; #[cfg(not(feature = "std"))] -use rstd::{slice, vec::Vec}; +use sp_std::{slice, vec::Vec}; pub use sp_runtime_interface_proc_macro::{PassByCodec, PassByInner, PassByEnum}; diff --git a/substrate/primitives/runtime-interface/src/wasm.rs b/substrate/primitives/runtime-interface/src/wasm.rs index 7ac890a3ca..508f0c4f26 100644 --- a/substrate/primitives/runtime-interface/src/wasm.rs +++ b/substrate/primitives/runtime-interface/src/wasm.rs @@ -18,7 +18,7 @@ use crate::RIType; -use rstd::cell::Cell; +use sp_std::cell::Cell; /// Something that can be created from a ffi value. /// diff --git a/substrate/primitives/runtime-interface/test-wasm/Cargo.toml b/substrate/primitives/runtime-interface/test-wasm/Cargo.toml index 4df59d03b0..0d9288de05 100644 --- a/substrate/primitives/runtime-interface/test-wasm/Cargo.toml +++ b/substrate/primitives/runtime-interface/test-wasm/Cargo.toml @@ -7,7 +7,7 @@ build = "build.rs" [dependencies] runtime-interface = { package = "sp-runtime-interface", path = "../", default-features = false } -rstd = { package = "sp-std", path = "../../sr-std", default-features = false } +sp-std = { path = "../../std", default-features = false } runtime-io = { package = "sp-io", path = "../../sr-io", default-features = false } primitives = { package = "sp-core", path = "../../core", default-features = false } @@ -16,4 +16,4 @@ wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1. [features] default = [ "std" ] -std = [ "runtime-interface/std", "rstd/std", "primitives/std", "runtime-io/std" ] +std = [ "runtime-interface/std", "sp-std/std", "primitives/std", "runtime-io/std" ] diff --git a/substrate/primitives/runtime-interface/test-wasm/src/lib.rs b/substrate/primitives/runtime-interface/test-wasm/src/lib.rs index d61315c521..93e9f5b29b 100644 --- a/substrate/primitives/runtime-interface/test-wasm/src/lib.rs +++ b/substrate/primitives/runtime-interface/test-wasm/src/lib.rs @@ -21,7 +21,7 @@ use runtime_interface::runtime_interface; #[cfg(not(feature = "std"))] -use rstd::{vec, vec::Vec, mem, convert::TryFrom}; +use sp_std::{vec, vec::Vec, mem, convert::TryFrom}; use primitives::{sr25519::Public, wasm_export_functions}; @@ -95,8 +95,8 @@ extern "C" { /// Make sure the old runtime interface needs to be imported. #[no_mangle] pub fn force_old_runtime_interface_import() { - unsafe { ext_clear_storage(rstd::ptr::null(), 0); } - unsafe { ext_keccak_256(rstd::ptr::null(), 0, rstd::ptr::null_mut()); } + unsafe { ext_clear_storage(sp_std::ptr::null(), 0); } + unsafe { ext_keccak_256(sp_std::ptr::null(), 0, sp_std::ptr::null_mut()); } } /// This function is not used, but we require it for the compiler to include `runtime-io`. @@ -173,7 +173,7 @@ wasm_export_functions! { fn test_invalid_utf8_data_should_return_an_error() { let data = vec![0, 159, 146, 150]; // I'm an evil hacker, trying to hack! - let data_str = unsafe { rstd::str::from_utf8_unchecked(&data) }; + let data_str = unsafe { sp_std::str::from_utf8_unchecked(&data) }; test_api::invalid_utf8_data(data_str); } diff --git a/substrate/primitives/runtime/Cargo.toml b/substrate/primitives/runtime/Cargo.toml index bfec26f0cc..8c855d7bb0 100644 --- a/substrate/primitives/runtime/Cargo.toml +++ b/substrate/primitives/runtime/Cargo.toml @@ -10,7 +10,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", default-features = primitives = { package = "sp-core", path = "../core", default-features = false } app-crypto = { package = "sc-application-crypto", path = "../application-crypto", default-features = false } arithmetic = { package = "sp-arithmetic", path = "../sr-arithmetic", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } runtime_io = { package = "sp-io", path = "../sr-io", default-features = false } log = { version = "0.4.8", optional = true } paste = "0.1.6" @@ -32,7 +32,7 @@ std = [ "log", "primitives/std", "rand", - "rstd/std", + "sp-std/std", "runtime_io/std", "serde", "inherents/std", diff --git a/substrate/primitives/runtime/src/generic/block.rs b/substrate/primitives/runtime/src/generic/block.rs index 3383e25760..12b2f82eac 100644 --- a/substrate/primitives/runtime/src/generic/block.rs +++ b/substrate/primitives/runtime/src/generic/block.rs @@ -22,7 +22,7 @@ use std::fmt; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; -use rstd::prelude::*; +use sp_std::prelude::*; use primitives::RuntimeDebug; use crate::codec::{Codec, Encode, Decode}; use crate::traits::{self, Member, Block as BlockT, Header as HeaderT, MaybeSerialize}; diff --git a/substrate/primitives/runtime/src/generic/digest.rs b/substrate/primitives/runtime/src/generic/digest.rs index 83f2c6f174..c74d09076b 100644 --- a/substrate/primitives/runtime/src/generic/digest.rs +++ b/substrate/primitives/runtime/src/generic/digest.rs @@ -19,7 +19,7 @@ #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; -use rstd::prelude::*; +use sp_std::prelude::*; use crate::ConsensusEngineId; use crate::codec::{Decode, Encode, Input, Error}; diff --git a/substrate/primitives/runtime/src/generic/header.rs b/substrate/primitives/runtime/src/generic/header.rs index 75994749c5..aa47966956 100644 --- a/substrate/primitives/runtime/src/generic/header.rs +++ b/substrate/primitives/runtime/src/generic/header.rs @@ -25,7 +25,7 @@ use crate::traits::{ }; use crate::generic::Digest; use primitives::U256; -use rstd::{ +use sp_std::{ convert::TryFrom, fmt::Debug, }; @@ -104,10 +104,10 @@ impl codec::EncodeLike for Header where {} impl traits::Header for Header where - Number: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash + MaybeDisplay + + Number: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + MaybeDisplay + SimpleArithmetic + Codec + Copy + Into + TryFrom, Hash: HashT, - Hash::Output: Default + rstd::hash::Hash + Copy + Member + + Hash::Output: Default + sp_std::hash::Hash + Copy + Member + MaybeSerialize + Debug + MaybeDisplay + SimpleBitOps + Codec, { type Number = Number; @@ -152,9 +152,9 @@ impl traits::Header for Header where } impl Header where - Number: Member + rstd::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec + Into + TryFrom, + Number: Member + sp_std::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec + Into + TryFrom, Hash: HashT, - Hash::Output: Default + rstd::hash::Hash + Copy + Member + MaybeDisplay + SimpleBitOps + Codec, + Hash::Output: Default + sp_std::hash::Hash + Copy + Member + MaybeDisplay + SimpleBitOps + Codec, { /// Convenience helper for computing the hash of the header without having /// to import the trait. diff --git a/substrate/primitives/runtime/src/generic/mod.rs b/substrate/primitives/runtime/src/generic/mod.rs index 0138a15aee..79e0d912b9 100644 --- a/substrate/primitives/runtime/src/generic/mod.rs +++ b/substrate/primitives/runtime/src/generic/mod.rs @@ -37,10 +37,10 @@ pub use self::digest::{ }; use crate::codec::Encode; -use rstd::prelude::*; +use sp_std::prelude::*; fn encode_with_vec_prefix)>(encoder: F) -> Vec { - let size = ::rstd::mem::size_of::(); + let size = ::sp_std::mem::size_of::(); let reserve = match size { 0..=0b00111111 => 1, 0..=0b00111111_11111111 => 2, diff --git a/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs b/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs index e2bda54a31..a018dedf2a 100644 --- a/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs +++ b/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs @@ -16,7 +16,7 @@ //! Generic implementation of an unchecked (pre-verification) extrinsic. -use rstd::{fmt, prelude::*}; +use sp_std::{fmt, prelude::*}; use runtime_io::hashing::blake2_256; use codec::{Decode, Encode, EncodeLike, Input, Error}; use crate::{ @@ -322,7 +322,7 @@ mod tests { type DispatchInfo = (); type Pre = (); - fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) } + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } } type Ex = UncheckedExtrinsic; diff --git a/substrate/primitives/runtime/src/lib.rs b/substrate/primitives/runtime/src/lib.rs index 20fdd083db..c4433b9076 100644 --- a/substrate/primitives/runtime/src/lib.rs +++ b/substrate/primitives/runtime/src/lib.rs @@ -29,7 +29,7 @@ pub use codec; #[doc(hidden)] pub use serde; #[doc(hidden)] -pub use rstd; +pub use sp_std; #[doc(hidden)] pub use paste; @@ -40,8 +40,8 @@ pub use app_crypto; #[cfg(feature = "std")] pub use primitives::storage::{StorageOverlay, ChildrenStorageOverlay}; -use rstd::prelude::*; -use rstd::convert::TryFrom; +use sp_std::prelude::*; +use sp_std::convert::TryFrom; use primitives::{crypto, ed25519, sr25519, ecdsa, hash::{H256, H512}}; use codec::{Encode, Decode}; @@ -613,14 +613,14 @@ macro_rules! assert_eq_error_rate { #[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] pub struct OpaqueExtrinsic(pub Vec); -impl rstd::fmt::Debug for OpaqueExtrinsic { +impl sp_std::fmt::Debug for OpaqueExtrinsic { #[cfg(feature = "std")] - fn fmt(&self, fmt: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(fmt, "{}", primitives::hexdisplay::HexDisplay::from(&self.0)) } #[cfg(not(feature = "std"))] - fn fmt(&self, _fmt: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } diff --git a/substrate/primitives/runtime/src/offchain/http.rs b/substrate/primitives/runtime/src/offchain/http.rs index 88df90893b..8fc6ac025c 100644 --- a/substrate/primitives/runtime/src/offchain/http.rs +++ b/substrate/primitives/runtime/src/offchain/http.rs @@ -47,10 +47,10 @@ //! assert_eq!(body.error(), &None); //! ``` -use rstd::str; -use rstd::prelude::Vec; +use sp_std::str; +use sp_std::prelude::Vec; #[cfg(not(feature = "std"))] -use rstd::prelude::vec; +use sp_std::prelude::vec; use primitives::RuntimeDebug; use primitives::offchain::{ Timestamp, @@ -111,7 +111,7 @@ mod header { /// Returns the name of this header. pub fn name(&self) -> &str { // Header keys are always produced from `&str` so this is safe. - // we don't store them as `Strings` to avoid bringing `alloc::String` to rstd + // we don't store them as `Strings` to avoid bringing `alloc::String` to sp-std // or here. unsafe { str::from_utf8_unchecked(&self.name) } } @@ -119,7 +119,7 @@ mod header { /// Returns the value of this header. pub fn value(&self) -> &str { // Header values are always produced from `&str` so this is safe. - // we don't store them as `Strings` to avoid bringing `alloc::String` to rstd + // we don't store them as `Strings` to avoid bringing `alloc::String` to sp-std // or here. unsafe { str::from_utf8_unchecked(&self.value) } } diff --git a/substrate/primitives/runtime/src/traits.rs b/substrate/primitives/runtime/src/traits.rs index 5400c5d3af..a18783782a 100644 --- a/substrate/primitives/runtime/src/traits.rs +++ b/substrate/primitives/runtime/src/traits.rs @@ -16,8 +16,8 @@ //! Primitives for the runtime modules. -use rstd::prelude::*; -use rstd::{self, result, marker::PhantomData, convert::{TryFrom, TryInto}, fmt::Debug}; +use sp_std::prelude::*; +use sp_std::{self, result, marker::PhantomData, convert::{TryFrom, TryInto}, fmt::Debug}; use runtime_io; #[cfg(feature = "std")] use std::fmt::Display; @@ -316,15 +316,15 @@ impl Clear for T { /// A meta trait for all bit ops. pub trait SimpleBitOps: Sized + Clear + - rstd::ops::BitOr + - rstd::ops::BitXor + - rstd::ops::BitAnd + sp_std::ops::BitOr + + sp_std::ops::BitXor + + sp_std::ops::BitAnd {} impl + - rstd::ops::BitXor + - rstd::ops::BitAnd + sp_std::ops::BitOr + + sp_std::ops::BitXor + + sp_std::ops::BitAnd > SimpleBitOps for T {} /// The block finalization trait. Implementing this lets you express what should happen @@ -369,7 +369,7 @@ pub trait OffchainWorker { // traits must be fulfilled by all type parameters. pub trait Hash: 'static + MaybeSerializeDeserialize + Debug + Clone + Eq + PartialEq { /// The hash type produced. - type Output: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash + type Output: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + AsRef<[u8]> + AsMut<[u8]> + Copy + Default + Encode + Decode; /// The associated hash_db Hasher type. @@ -481,7 +481,7 @@ impl_maybe_marker!( MaybeDisplay: Display; /// A type that implements Hash when in std environment. - MaybeHash: rstd::hash::Hash; + MaybeHash: sp_std::hash::Hash; /// A type that implements Serialize when in std environment. MaybeSerialize: Serialize; @@ -523,10 +523,10 @@ pub trait IsMember { /// You can also create a `new` one from those fields. pub trait Header: Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + 'static { /// Header number. - type Number: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash + type Number: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec; /// Header hash type - type Hash: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash + type Hash: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>; /// Hashing algorithm type Hashing: Hash; @@ -581,7 +581,7 @@ pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + 'st /// Header type. type Header: Header; /// Block hash type. - type Hash: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash + type Hash: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>; /// Returns a reference to the header. @@ -865,7 +865,7 @@ impl SignedExtension for () { type Call = (); type Pre = (); type DispatchInfo = (); - fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) } + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } } /// An "executable" piece of information, used by the standard Substrate Executive in order to @@ -906,7 +906,7 @@ pub trait Applyable: Sized + Send + Sync { } /// Auxiliary wrapper that holds an api instance and binds it to the given lifetime. -pub struct ApiRef<'a, T>(T, rstd::marker::PhantomData<&'a ()>); +pub struct ApiRef<'a, T>(T, sp_std::marker::PhantomData<&'a ()>); impl<'a, T> From for ApiRef<'a, T> { fn from(api: T) -> Self { @@ -914,7 +914,7 @@ impl<'a, T> From for ApiRef<'a, T> { } } -impl<'a, T> rstd::ops::Deref for ApiRef<'a, T> { +impl<'a, T> sp_std::ops::Deref for ApiRef<'a, T> { type Target = T; fn deref(&self) -> &Self::Target { @@ -922,7 +922,7 @@ impl<'a, T> rstd::ops::Deref for ApiRef<'a, T> { } } -impl<'a, T> rstd::ops::DerefMut for ApiRef<'a, T> { +impl<'a, T> sp_std::ops::DerefMut for ApiRef<'a, T> { fn deref_mut(&mut self) -> &mut T { &mut self.0 } @@ -1161,7 +1161,7 @@ macro_rules! impl_opaque_keys { /// The generated key pairs are stored in the keystore. /// /// Returns the concatenated SCALE encoded public keys. - pub fn generate(seed: Option<$crate::rstd::vec::Vec>) -> $crate::rstd::vec::Vec { + pub fn generate(seed: Option<$crate::sp_std::vec::Vec>) -> $crate::sp_std::vec::Vec { let keys = Self{ $( $field: < diff --git a/substrate/primitives/runtime/src/transaction_validity.rs b/substrate/primitives/runtime/src/transaction_validity.rs index be9a1d0fd9..b08455aab6 100644 --- a/substrate/primitives/runtime/src/transaction_validity.rs +++ b/substrate/primitives/runtime/src/transaction_validity.rs @@ -16,7 +16,7 @@ //! Transaction validity interface. -use rstd::prelude::*; +use sp_std::prelude::*; use crate::codec::{Encode, Decode}; use crate::RuntimeDebug; diff --git a/substrate/primitives/session/Cargo.toml b/substrate/primitives/session/Cargo.toml index 4feda93487..ab37c021ec 100644 --- a/substrate/primitives/session/Cargo.toml +++ b/substrate/primitives/session/Cargo.toml @@ -6,9 +6,9 @@ edition = "2018" [dependencies] sp-api = { path = "../sr-api", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } sp-runtime = { path = "../runtime", optional = true } [features] default = [ "std" ] -std = [ "sp-api/std", "rstd/std", "sp-runtime" ] +std = [ "sp-api/std", "sp-std/std", "sp-runtime" ] diff --git a/substrate/primitives/session/src/lib.rs b/substrate/primitives/session/src/lib.rs index 2c4b118d5b..f6be084a67 100644 --- a/substrate/primitives/session/src/lib.rs +++ b/substrate/primitives/session/src/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::vec::Vec; +use sp_std::vec::Vec; #[cfg(feature = "std")] use sp_runtime::{generic::BlockId, traits::{ProvideRuntimeApi, Block as BlockT}}; diff --git a/substrate/primitives/sr-api/Cargo.toml b/substrate/primitives/sr-api/Cargo.toml index 608d9e30dd..c56f936a6b 100644 --- a/substrate/primitives/sr-api/Cargo.toml +++ b/substrate/primitives/sr-api/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } sp-api-proc-macro = { path = "proc-macro" } primitives = { package = "sp-core", path = "../core", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } sp-runtime = { path = "../runtime", default-features = false } sp-version = { path = "../sr-version", default-features = false } state-machine = { package = "sp-state-machine", path = "../../primitives/state-machine", optional = true } @@ -26,7 +26,7 @@ default = [ "std" ] std = [ "codec/std", "primitives/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", "state-machine", "sp-version/std", diff --git a/substrate/primitives/sr-api/src/lib.rs b/substrate/primitives/sr-api/src/lib.rs index edbf567ea6..47f5b1489b 100644 --- a/substrate/primitives/sr-api/src/lib.rs +++ b/substrate/primitives/sr-api/src/lib.rs @@ -52,9 +52,9 @@ pub use primitives::{offchain, ExecutionContext}; #[doc(hidden)] pub use sp_version::{ApiId, RuntimeVersion, ApisVec, create_apis_vec}; #[doc(hidden)] -pub use rstd::{slice, mem}; +pub use sp_std::{slice, mem}; #[cfg(feature = "std")] -use rstd::result; +use sp_std::result; #[doc(hidden)] pub use codec::{Encode, Decode}; use primitives::OpaqueMetadata; diff --git a/substrate/primitives/sr-arithmetic/Cargo.toml b/substrate/primitives/sr-arithmetic/Cargo.toml index 84137a8f5a..7b6b8cc64c 100644 --- a/substrate/primitives/sr-arithmetic/Cargo.toml +++ b/substrate/primitives/sr-arithmetic/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } integer-sqrt = "0.1.2" num-traits = { version = "0.2.8", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-debug-derive = { path = "../../primitives/core/debug-derive", default-features = false } @@ -22,7 +22,7 @@ default = ["std"] std = [ "codec/std", "num-traits/std", - "rstd/std", + "sp-std/std", "serde", "sp-debug-derive/std", ] diff --git a/substrate/primitives/sr-arithmetic/fuzzer/Cargo.lock b/substrate/primitives/sr-arithmetic/fuzzer/Cargo.lock index 83fcd3db3d..de8a764f1f 100644 --- a/substrate/primitives/sr-arithmetic/fuzzer/Cargo.lock +++ b/substrate/primitives/sr-arithmetic/fuzzer/Cargo.lock @@ -285,39 +285,30 @@ dependencies = [ ] [[package]] -name = "sr-arithmetic" +name = "sp-arithmetic" version = "2.0.0" dependencies = [ "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 2.0.0", - "substrate-debug-derive 2.0.0", + "sp-debug-derive 2.0.0", + "sp-std 2.0.0", ] [[package]] -name = "sr-arithmetic-fuzzer" +name = "sp-arithmetic-fuzzer" version = "2.0.0" dependencies = [ "honggfuzz 0.5.45 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-arithmetic 2.0.0", + "sp-arithmetic 2.0.0", ] [[package]] -name = "sr-std" -version = "2.0.0" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "substrate-debug-derive" +name = "sp-debug-derive" version = "2.0.0" dependencies = [ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -325,6 +316,15 @@ dependencies = [ "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "sp-std" +version = "2.0.0" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "syn" version = "0.15.44" diff --git a/substrate/primitives/sr-arithmetic/src/biguint.rs b/substrate/primitives/sr-arithmetic/src/biguint.rs index 1a701a5ebd..9d69ccad81 100644 --- a/substrate/primitives/sr-arithmetic/src/biguint.rs +++ b/substrate/primitives/sr-arithmetic/src/biguint.rs @@ -17,7 +17,7 @@ //! Infinite precision unsigned integer for substrate runtime. use num_traits::Zero; -use rstd::{cmp::Ordering, ops, prelude::*, cell::RefCell, convert::TryFrom}; +use sp_std::{cmp::Ordering, ops, prelude::*, cell::RefCell, convert::TryFrom}; // 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 @@ -427,9 +427,9 @@ impl BigUint { } } -impl rstd::fmt::Debug for BigUint { +impl sp_std::fmt::Debug for BigUint { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter<'_>) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { write!( f, "BigUint {{ {:?} ({:?})}}", @@ -439,7 +439,7 @@ impl rstd::fmt::Debug for BigUint { } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter<'_>) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { Ok(()) } @@ -646,7 +646,7 @@ pub mod tests { #[test] fn can_try_build_numbers_from_types() { - use rstd::convert::TryFrom; + 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_value() as u64 + 2); assert_eq!( diff --git a/substrate/primitives/sr-arithmetic/src/fixed64.rs b/substrate/primitives/sr-arithmetic/src/fixed64.rs index 5c68cc5529..6f906b0b29 100644 --- a/substrate/primitives/sr-arithmetic/src/fixed64.rs +++ b/substrate/primitives/sr-arithmetic/src/fixed64.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use rstd::{ +use sp_std::{ ops, prelude::*, convert::{TryFrom, TryInto}, }; @@ -179,14 +179,14 @@ impl CheckedDiv for Fixed64 { } } -impl rstd::fmt::Debug for Fixed64 { +impl sp_std::fmt::Debug for Fixed64 { #[cfg(feature = "std")] - fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "Fixed64({},{})", self.0 / DIV, (self.0 % DIV) / 1000) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result { + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } } diff --git a/substrate/primitives/sr-arithmetic/src/helpers_128bit.rs b/substrate/primitives/sr-arithmetic/src/helpers_128bit.rs index 10cc94ae77..475d802f3f 100644 --- a/substrate/primitives/sr-arithmetic/src/helpers_128bit.rs +++ b/substrate/primitives/sr-arithmetic/src/helpers_128bit.rs @@ -21,7 +21,7 @@ use crate::biguint; use num_traits::Zero; -use rstd::{cmp::{min, max}, convert::TryInto, mem}; +use sp_std::{cmp::{min, max}, convert::TryInto, mem}; /// Helper gcd function used in Rational128 implementation. pub fn gcd(a: u128, b: u128) -> u128 { diff --git a/substrate/primitives/sr-arithmetic/src/per_things.rs b/substrate/primitives/sr-arithmetic/src/per_things.rs index 4ab7f2f25a..47dfc98f3b 100644 --- a/substrate/primitives/sr-arithmetic/src/per_things.rs +++ b/substrate/primitives/sr-arithmetic/src/per_things.rs @@ -17,7 +17,7 @@ #[cfg(feature = "std")] use serde::{Serialize, Deserialize}; -use rstd::{ops, prelude::*, convert::TryInto}; +use sp_std::{ops, prelude::*, convert::TryInto}; use codec::{Encode, Decode, CompactAs}; use crate::traits::{SaturatedConversion, UniqueSaturatedInto, Saturating}; use sp_debug_derive::RuntimeDebug; diff --git a/substrate/primitives/sr-arithmetic/src/rational128.rs b/substrate/primitives/sr-arithmetic/src/rational128.rs index 124d685a4f..a747be84a8 100644 --- a/substrate/primitives/sr-arithmetic/src/rational128.rs +++ b/substrate/primitives/sr-arithmetic/src/rational128.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use rstd::{cmp::Ordering, prelude::*}; +use sp_std::{cmp::Ordering, prelude::*}; use crate::helpers_128bit; use num_traits::Zero; use sp_debug_derive::RuntimeDebug; diff --git a/substrate/primitives/sr-arithmetic/src/traits.rs b/substrate/primitives/sr-arithmetic/src/traits.rs index d02425066f..d8a46ffd30 100644 --- a/substrate/primitives/sr-arithmetic/src/traits.rs +++ b/substrate/primitives/sr-arithmetic/src/traits.rs @@ -16,14 +16,14 @@ //! Primitives for the runtime modules. -use rstd::{self, convert::{TryFrom, TryInto}}; +use sp_std::{self, convert::{TryFrom, TryInto}}; use codec::HasCompact; pub use integer_sqrt::IntegerSquareRoot; pub use num_traits::{ Zero, One, Bounded, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv, CheckedShl, CheckedShr }; -use rstd::ops::{ +use sp_std::ops::{ Add, Sub, Mul, Div, Rem, AddAssign, SubAssign, MulAssign, DivAssign, RemAssign, Shl, Shr }; diff --git a/substrate/primitives/sr-io/Cargo.toml b/substrate/primitives/sr-io/Cargo.toml index 79d25f2d96..b124ef7843 100644 --- a/substrate/primitives/sr-io/Cargo.toml +++ b/substrate/primitives/sr-io/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false } hash-db = { version = "0.15.2", default-features = false } primitives = { package = "sp-core", path = "../core", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } libsecp256k1 = { version = "0.3.0", optional = true } sp-state-machine = { path = "../../primitives/state-machine", optional = true } runtime-interface = { package = "sp-runtime-interface", path = "../runtime-interface", default-features = false } @@ -21,7 +21,7 @@ default = ["std"] std = [ "primitives/std", "codec/std", - "rstd/std", + "sp-std/std", "hash-db/std", "trie", "sp-state-machine", diff --git a/substrate/primitives/sr-io/src/lib.rs b/substrate/primitives/sr-io/src/lib.rs index 7fdab1ab3b..ad92b01964 100644 --- a/substrate/primitives/sr-io/src/lib.rs +++ b/substrate/primitives/sr-io/src/lib.rs @@ -28,10 +28,10 @@ #![cfg_attr(not(feature = "std"), doc = "Substrate's runtime standard library as compiled without Rust's standard library.")] -use rstd::vec::Vec; +use sp_std::vec::Vec; #[cfg(feature = "std")] -use rstd::ops::Deref; +use sp_std::ops::Deref; #[cfg(feature = "std")] use primitives::{ @@ -775,7 +775,7 @@ mod allocator_impl { #[no_mangle] pub fn panic(info: &core::panic::PanicInfo) -> ! { unsafe { - let message = rstd::alloc::format!("{}", info); + let message = sp_std::alloc::format!("{}", info); logging::log(LogLevel::Error, "runtime", message.as_bytes()); core::intrinsics::abort() } diff --git a/substrate/primitives/sr-sandbox/Cargo.toml b/substrate/primitives/sr-sandbox/Cargo.toml index 0380f5b591..4cd946ef66 100755 --- a/substrate/primitives/sr-sandbox/Cargo.toml +++ b/substrate/primitives/sr-sandbox/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] wasmi = { version = "0.6.2", optional = true } primitives = { package = "sp-core", path = "../core", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } runtime-io = { package = "sp-io", path = "../sr-io", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } @@ -20,7 +20,7 @@ default = ["std"] std = [ "wasmi", "primitives/std", - "rstd/std", + "sp-std/std", "codec/std", "runtime-io/std", ] diff --git a/substrate/primitives/sr-sandbox/src/lib.rs b/substrate/primitives/sr-sandbox/src/lib.rs index 17b2cb7c1e..a006655c78 100755 --- a/substrate/primitives/sr-sandbox/src/lib.rs +++ b/substrate/primitives/sr-sandbox/src/lib.rs @@ -38,7 +38,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), feature(core_intrinsics))] -use rstd::prelude::*; +use sp_std::prelude::*; pub use primitives::sandbox::{TypedValue, ReturnValue, HostError}; diff --git a/substrate/primitives/sr-sandbox/with_std.rs b/substrate/primitives/sr-sandbox/with_std.rs index afc092686e..dacaa3a198 100755 --- a/substrate/primitives/sr-sandbox/with_std.rs +++ b/substrate/primitives/sr-sandbox/with_std.rs @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use rstd::collections::btree_map::BTreeMap; -use rstd::fmt; +use sp_std::collections::btree_map::BTreeMap; +use sp_std::fmt; use wasmi::{ Externals, FuncInstance, FuncRef, GlobalDescriptor, GlobalRef, ImportResolver, diff --git a/substrate/primitives/sr-sandbox/without_std.rs b/substrate/primitives/sr-sandbox/without_std.rs index d7fffbf88b..fb3267a91c 100755 --- a/substrate/primitives/sr-sandbox/without_std.rs +++ b/substrate/primitives/sr-sandbox/without_std.rs @@ -14,14 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use rstd::{prelude::*, slice, marker, mem, vec, rc::Rc}; +use sp_std::{prelude::*, slice, marker, mem, vec, rc::Rc}; use codec::{Decode, Encode}; use primitives::sandbox as sandbox_primitives; use super::{Error, TypedValue, ReturnValue, HostFuncType}; use runtime_io::sandbox; mod ffi { - use rstd::mem; + use sp_std::mem; use super::HostFuncType; /// Index into the default table that points to a `HostFuncType`. diff --git a/substrate/primitives/sr-staking-primitives/Cargo.toml b/substrate/primitives/sr-staking-primitives/Cargo.toml index 671df45a56..2cac41bd40 100644 --- a/substrate/primitives/sr-staking-primitives/Cargo.toml +++ b/substrate/primitives/sr-staking-primitives/Cargo.toml @@ -7,12 +7,12 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } sp-runtime = { path = "../runtime", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } [features] default = ["std"] std = [ "codec/std", "sp-runtime/std", - "rstd/std", + "sp-std/std", ] diff --git a/substrate/primitives/sr-staking-primitives/src/offence.rs b/substrate/primitives/sr-staking-primitives/src/offence.rs index 9a3eb1bbfe..33170193ec 100644 --- a/substrate/primitives/sr-staking-primitives/src/offence.rs +++ b/substrate/primitives/sr-staking-primitives/src/offence.rs @@ -17,7 +17,7 @@ //! Common traits and types that are useful for describing offences for usage in environments //! that use staking. -use rstd::vec::Vec; +use sp_std::vec::Vec; use codec::{Encode, Decode}; use sp_runtime::Perbill; diff --git a/substrate/primitives/sr-version/Cargo.toml b/substrate/primitives/sr-version/Cargo.toml index 3469fead36..626313a702 100644 --- a/substrate/primitives/sr-version/Cargo.toml +++ b/substrate/primitives/sr-version/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" impl-serde = { version = "0.2.3", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.0.5", default-features = false, features = ["derive"] } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } sp-runtime = { path = "../runtime", default-features = false } [features] @@ -17,6 +17,6 @@ std = [ "impl-serde", "serde", "codec/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", ] diff --git a/substrate/primitives/sr-std/Cargo.toml b/substrate/primitives/std/Cargo.toml similarity index 100% rename from substrate/primitives/sr-std/Cargo.toml rename to substrate/primitives/std/Cargo.toml diff --git a/substrate/primitives/sr-std/src/lib.rs b/substrate/primitives/std/src/lib.rs similarity index 100% rename from substrate/primitives/sr-std/src/lib.rs rename to substrate/primitives/std/src/lib.rs diff --git a/substrate/primitives/sr-std/with_std.rs b/substrate/primitives/std/with_std.rs similarity index 100% rename from substrate/primitives/sr-std/with_std.rs rename to substrate/primitives/std/with_std.rs diff --git a/substrate/primitives/sr-std/without_std.rs b/substrate/primitives/std/without_std.rs similarity index 100% rename from substrate/primitives/sr-std/without_std.rs rename to substrate/primitives/std/without_std.rs diff --git a/substrate/primitives/timestamp/Cargo.toml b/substrate/primitives/timestamp/Cargo.toml index f4cabd6d12..f8f4fc9315 100644 --- a/substrate/primitives/timestamp/Cargo.toml +++ b/substrate/primitives/timestamp/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] sp-api = { path = "../sr-api", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } sp-runtime = { path = "../runtime", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } inherents = { package = "sp-inherents", path = "../inherents", default-features = false } @@ -16,7 +16,7 @@ impl-trait-for-tuples = "0.1.3" default = [ "std" ] std = [ "sp-api/std", - "rstd/std", + "sp-std/std", "sp-runtime/std", "codec/std", "inherents/std", diff --git a/substrate/primitives/trie/Cargo.toml b/substrate/primitives/trie/Cargo.toml index 494a7754ae..e77d5665b4 100644 --- a/substrate/primitives/trie/Cargo.toml +++ b/substrate/primitives/trie/Cargo.toml @@ -13,7 +13,7 @@ harness = false [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } -rstd = { package = "sp-std", path = "../sr-std", default-features = false } +sp-std = { path = "../std", default-features = false } hash-db = { version = "0.15.2", default-features = false } trie-db = { version = "0.16.0", default-features = false } trie-root = { version = "0.15.2", default-features = false } @@ -29,7 +29,7 @@ hex-literal = "0.2.1" [features] default = ["std"] std = [ - "rstd/std", + "sp-std/std", "codec/std", "hash-db/std", "memory-db/std", diff --git a/substrate/primitives/trie/src/lib.rs b/substrate/primitives/trie/src/lib.rs index e1315f011f..711ce302f0 100644 --- a/substrate/primitives/trie/src/lib.rs +++ b/substrate/primitives/trie/src/lib.rs @@ -23,8 +23,8 @@ mod node_header; mod node_codec; mod trie_stream; -use rstd::boxed::Box; -use rstd::vec::Vec; +use sp_std::boxed::Box; +use sp_std::vec::Vec; use hash_db::Hasher; /// Our `NodeCodec`-specific error. pub use error::Error; @@ -44,7 +44,7 @@ pub use hash_db::{HashDB as HashDBT, EMPTY_PREFIX}; #[derive(Default)] /// substrate trie layout -pub struct Layout(rstd::marker::PhantomData); +pub struct Layout(sp_std::marker::PhantomData); impl TrieLayout for Layout { const USE_EXTENSION: bool = false; diff --git a/substrate/primitives/trie/src/node_codec.rs b/substrate/primitives/trie/src/node_codec.rs index e31ce8cc91..0b48941ca6 100644 --- a/substrate/primitives/trie/src/node_codec.rs +++ b/substrate/primitives/trie/src/node_codec.rs @@ -16,10 +16,10 @@ //! `NodeCodec` implementation for Substrate's trie format. -use rstd::marker::PhantomData; -use rstd::ops::Range; -use rstd::vec::Vec; -use rstd::borrow::Borrow; +use sp_std::marker::PhantomData; +use sp_std::ops::Range; +use sp_std::vec::Vec; +use sp_std::borrow::Borrow; use codec::{Encode, Decode, Input, Compact}; use hash_db::Hasher; use trie_db::{self, node::{NibbleSlicePlan, NodePlan, NodeHandlePlan}, ChildReference, @@ -30,7 +30,7 @@ use super::{node_header::{NodeHeader, NodeKind}}; /// Helper struct for trie node decoder. This implements `codec::Input` on a byte slice, while /// tracking the absolute position. This is similar to `std::io::Cursor` but does not implement -/// `Read` and `io` is not in `rstd`. +/// `Read` and `io` is not in `sp-std`. struct ByteSliceInput<'a> { data: &'a [u8], offset: usize, @@ -94,7 +94,7 @@ impl NodeCodecT for NodeCodec { H::hash(::empty_node()) } - fn decode_plan(data: &[u8]) -> rstd::result::Result { + fn decode_plan(data: &[u8]) -> sp_std::result::Result { let mut input = ByteSliceInput::new(data); match NodeHeader::decode(&mut input)? { NodeHeader::Null => Ok(NodePlan::Empty), @@ -229,7 +229,7 @@ fn partial_from_iterator_encode>( nibble_count: usize, node_kind: NodeKind, ) -> Vec { - let nibble_count = rstd::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibble_count); + let nibble_count = sp_std::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibble_count); let mut output = Vec::with_capacity(3 + (nibble_count / nibble_ops::NIBBLE_PER_BYTE)); match node_kind { @@ -247,7 +247,7 @@ fn partial_encode(partial: Partial, node_kind: NodeKind) -> Vec { let number_nibble_encoded = (partial.0).0 as usize; let nibble_count = partial.1.len() * nibble_ops::NIBBLE_PER_BYTE + number_nibble_encoded; - let nibble_count = rstd::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibble_count); + let nibble_count = sp_std::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibble_count); let mut output = Vec::with_capacity(3 + partial.1.len()); match node_kind { @@ -290,4 +290,3 @@ impl Bitmap { dest[1] = (bitmap / 256) as u8; } } - diff --git a/substrate/primitives/trie/src/node_header.rs b/substrate/primitives/trie/src/node_header.rs index 616273e574..34586d8b52 100644 --- a/substrate/primitives/trie/src/node_header.rs +++ b/substrate/primitives/trie/src/node_header.rs @@ -18,7 +18,7 @@ use crate::trie_constants; use codec::{Encode, Decode, Input, Output}; -use rstd::iter::once; +use sp_std::iter::once; /// A node header #[derive(Copy, Clone, PartialEq, Eq)] @@ -72,9 +72,9 @@ impl Decode for NodeHeader { /// Size encoding allows unlimited, length unefficient, representation, but /// is bounded to 16 bit maximum value to avoid possible DOS. pub(crate) fn size_and_prefix_iterator(size: usize, prefix: u8) -> impl Iterator { - let size = rstd::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, size); + let size = sp_std::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, size); - let l1 = rstd::cmp::min(62, size); + let l1 = sp_std::cmp::min(62, size); let (first_byte, mut rem) = if size == l1 { (once(prefix + l1 as u8), 0) } else { @@ -94,7 +94,7 @@ pub(crate) fn size_and_prefix_iterator(size: usize, prefix: u8) -> impl Iterator None } }; - first_byte.chain(rstd::iter::from_fn(next_bytes)) + first_byte.chain(sp_std::iter::from_fn(next_bytes)) } /// Encodes size and prefix to a stream output. diff --git a/substrate/primitives/trie/src/trie_stream.rs b/substrate/primitives/trie/src/trie_stream.rs index 2629cefac8..926397346f 100644 --- a/substrate/primitives/trie/src/trie_stream.rs +++ b/substrate/primitives/trie/src/trie_stream.rs @@ -19,7 +19,7 @@ use hash_db::Hasher; use trie_root; use codec::Encode; -use rstd::vec::Vec; +use sp_std::vec::Vec; use crate::trie_constants; use crate::node_header::{NodeKind, size_and_prefix_iterator}; use crate::node_codec::Bitmap; @@ -51,7 +51,7 @@ fn branch_node_bit_mask(has_children: impl Iterator) -> (u8, u8) { /// Create a leaf/branch node, encoding a number of nibbles. fn fuse_nibbles_node<'a>(nibbles: &'a [u8], kind: NodeKind) -> impl Iterator + 'a { - let size = rstd::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibbles.len()); + let size = sp_std::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibbles.len()); let iter_start = match kind { NodeKind::Leaf => size_and_prefix_iterator(size, trie_constants::LEAF_PREFIX_MASK), @@ -125,7 +125,7 @@ fn branch_node(has_value: bool, has_children: impl Iterator) -> [u8 result } -fn branch_node_buffered(has_value: bool, has_children: I, output: &mut[u8]) +fn branch_node_buffered(has_value: bool, has_children: I, output: &mut[u8]) where I: Iterator, { diff --git a/substrate/test/utils/runtime/Cargo.toml b/substrate/test/utils/runtime/Cargo.toml index 2523593499..40a5f17837 100644 --- a/substrate/test/utils/runtime/Cargo.toml +++ b/substrate/test/utils/runtime/Cargo.toml @@ -19,7 +19,7 @@ log = { version = "0.4.8", optional = true } memory-db = { version = "0.15.2", default-features = false } offchain-primitives = { package = "sp-offchain", path = "../../../primitives/offchain", default-features = false} primitives = { package = "sp-core", path = "../../../primitives/core", default-features = false } -rstd = { package = "sp-std", path = "../../../primitives/sr-std", default-features = false } +sp-std = { path = "../../../primitives/std", default-features = false } runtime-interface = { package = "sp-runtime-interface", path = "../../../primitives/runtime-interface", default-features = false} runtime_io = { package = "sp-io", path = "../../../primitives/sr-io", default-features = false } runtime_support = { package = "frame-support", path = "../../../frame/support", default-features = false } @@ -63,7 +63,7 @@ std = [ "offchain-primitives/std", "primitives/std", "primitives/std", - "rstd/std", + "sp-std/std", "runtime-interface/std", "runtime_io/std", "runtime_support/std", diff --git a/substrate/test/utils/runtime/src/lib.rs b/substrate/test/utils/runtime/src/lib.rs index 374ff0322e..4a0a5859c4 100644 --- a/substrate/test/utils/runtime/src/lib.rs +++ b/substrate/test/utils/runtime/src/lib.rs @@ -22,7 +22,7 @@ pub mod genesismap; pub mod system; -use rstd::{prelude::*, marker::PhantomData}; +use sp_std::{prelude::*, marker::PhantomData}; use codec::{Encode, Decode, Input, Error}; use primitives::{Blake2Hasher, OpaqueMetadata, RuntimeDebug}; @@ -415,7 +415,7 @@ fn code_using_trie() -> u64 { ].to_vec(); let mut mdb = PrefixedMemoryDB::default(); - let mut root = rstd::default::Default::default(); + let mut root = sp_std::default::Default::default(); let _ = { let v = &pairs; let mut t = TrieDBMut::::new(&mut mdb, &mut root); diff --git a/substrate/test/utils/runtime/src/system.rs b/substrate/test/utils/runtime/src/system.rs index a0c1a2769e..c936ba0444 100644 --- a/substrate/test/utils/runtime/src/system.rs +++ b/substrate/test/utils/runtime/src/system.rs @@ -17,7 +17,7 @@ //! System manager: Handles all of the top-level stuff; executing block/transaction, setting code //! and depositing logs. -use rstd::prelude::*; +use sp_std::prelude::*; use runtime_io::{ storage::root as storage_root, storage::changes_root as storage_changes_root, hashing::blake2_256,