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,16 +20,14 @@
use super::{Extrinsics, StorageKey, StorageValue};
#[cfg(not(feature = "std"))]
use sp_std::collections::btree_set::BTreeSet as Set;
use alloc::collections::btree_set::BTreeSet as Set;
#[cfg(feature = "std")]
use std::collections::HashSet as Set;
use crate::warn;
use alloc::collections::{btree_map::BTreeMap, btree_set::BTreeSet};
use core::hash::Hash;
use smallvec::SmallVec;
use sp_std::{
collections::{btree_map::BTreeMap, btree_set::BTreeSet},
hash::Hash,
};
const PROOF_OVERLAY_NON_EMPTY: &str = "\
An OverlayValue is always created with at least one transaction and dropped as soon
@@ -225,7 +223,7 @@ impl<K: Ord + Hash + Clone, V> OverlayedMap<K, V> {
/// This changeset might be created when there are already open transactions.
/// We need to catch up here so that the child is at the same transaction depth.
pub fn spawn_child(&self) -> Self {
use sp_std::iter::repeat;
use core::iter::repeat;
Self {
changes: Default::default(),
dirty_keys: repeat(Set::new()).take(self.transaction_depth()).collect(),
@@ -242,7 +240,7 @@ impl<K: Ord + Hash + Clone, V> OverlayedMap<K, V> {
/// Get an optional reference to the value stored for the specified key.
pub fn get<Q>(&self, key: &Q) -> Option<&OverlayedEntry<V>>
where
K: sp_std::borrow::Borrow<Q>,
K: core::borrow::Borrow<Q>,
Q: Ord + ?Sized,
{
self.changes.get(key)
@@ -448,7 +446,7 @@ impl OverlayedChangeSet {
/// Get the iterator over all changes that follow the supplied `key`.
pub fn changes_after(&self, key: &[u8]) -> impl Iterator<Item = (&[u8], &OverlayedValue)> {
use sp_std::ops::Bound;
use core::ops::Bound;
let range = (Bound::Excluded(key), Bound::Unbounded);
self.changes.range::<[u8], _>(range).map(|(k, v)| (k.as_slice(), v))
}