sp-std removal from substrate/primitives (#3274)

This PR removes sp-std crate from substrate/primitives sub-directories.

For now crates that have `pub use` of sp-std or export macros that would
necessitate users of the macros to `extern crate alloc` have been
excluded from this PR.

There should be no breaking changes in this PR.

---------

Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
Squirrel
2024-03-18 05:29:35 +00:00
committed by GitHub
parent 6b1179f13b
commit 1b5f4243d1
110 changed files with 254 additions and 278 deletions
-2
View File
@@ -22,7 +22,6 @@ impl-serde = { version = "0.4.0", optional = true, default-features = false }
ref-cast = "1.0.0"
serde = { features = ["alloc", "derive"], optional = true, workspace = true }
sp-debug-derive = { path = "../debug-derive", default-features = false }
sp-std = { path = "../std", default-features = false }
[features]
default = ["std"]
@@ -31,7 +30,6 @@ std = [
"impl-serde/std",
"serde/std",
"sp-debug-derive/std",
"sp-std/std",
]
# Serde support without relying on std features.
+7 -8
View File
@@ -19,18 +19,19 @@
#![cfg_attr(not(feature = "std"), no_std)]
use core::fmt::Display;
extern crate alloc;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use sp_debug_derive::RuntimeDebug;
use alloc::vec::Vec;
use codec::{Decode, Encode};
use ref_cast::RefCast;
use sp_std::{
use core::{
fmt::Display,
ops::{Deref, DerefMut},
vec::Vec,
};
use ref_cast::RefCast;
/// Storage key.
#[derive(PartialEq, Eq, RuntimeDebug)]
@@ -49,9 +50,7 @@ impl AsRef<[u8]> for StorageKey {
}
/// Storage key with read/write tracking information.
#[derive(
PartialEq, Eq, Ord, PartialOrd, sp_std::hash::Hash, RuntimeDebug, Clone, Encode, Decode,
)]
#[derive(PartialEq, Eq, Ord, PartialOrd, core::hash::Hash, RuntimeDebug, Clone, Encode, Decode)]
pub struct TrackedStorageKey {
pub key: Vec<u8>,
pub reads: u32,
@@ -441,7 +440,7 @@ impl From<StateVersion> for u8 {
impl TryFrom<u8> for StateVersion {
type Error = ();
fn try_from(val: u8) -> sp_std::result::Result<StateVersion, ()> {
fn try_from(val: u8) -> core::result::Result<StateVersion, ()> {
match val {
0 => Ok(StateVersion::V0),
1 => Ok(StateVersion::V1),