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
@@ -20,14 +20,16 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]
extern crate alloc;
pub use mmr_lib;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use core::fmt;
use scale_info::TypeInfo;
use sp_debug_derive::RuntimeDebug;
use sp_runtime::traits;
use sp_std::fmt;
#[cfg(not(feature = "std"))]
use sp_std::prelude::Vec;
pub mod utils;
@@ -248,10 +250,10 @@ impl<H: traits::Hash, L: FullLeaf> DataOrHash<H, L> {
pub struct Compact<H, T> {
/// Internal tuple representation.
pub tuple: T,
_hash: sp_std::marker::PhantomData<H>,
_hash: core::marker::PhantomData<H>,
}
impl<H, T> sp_std::ops::Deref for Compact<H, T> {
impl<H, T> core::ops::Deref for Compact<H, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
@@ -20,9 +20,9 @@
use codec::Encode;
use mmr_lib::helper;
use sp_runtime::traits::{CheckedAdd, CheckedSub, Header, One};
#[cfg(not(feature = "std"))]
use sp_std::prelude::Vec;
use alloc::vec::Vec;
use sp_runtime::traits::{CheckedAdd, CheckedSub, Header, One};
use crate::{Error, LeafIndex, NodeIndex};
@@ -131,7 +131,7 @@ impl NodesUtils {
/// Used for nodes added by now finalized blocks.
/// Never read keys using `node_canon_offchain_key` unless you sure that
/// there's no `node_offchain_key` key in the storage.
pub fn node_canon_offchain_key(prefix: &[u8], pos: NodeIndex) -> sp_std::prelude::Vec<u8> {
pub fn node_canon_offchain_key(prefix: &[u8], pos: NodeIndex) -> alloc::vec::Vec<u8> {
(prefix, pos).encode()
}
}