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
@@ -17,9 +17,10 @@
//! Infinite precision unsigned integer for substrate runtime.
use alloc::{vec, vec::Vec};
use codec::{Decode, Encode};
use core::{cell::RefCell, cmp::Ordering, ops};
use num_traits::{One, Zero};
use sp_std::{cell::RefCell, cmp::Ordering, ops, prelude::*, vec};
// A sensible value for this would be half of the dword size of the host machine. Since the
// runtime is compiled to 32bit webassembly, using 32 and 64 for single and double respectively
@@ -35,7 +36,7 @@ const SHIFT: usize = 32;
const B: Double = Single::max_value() as Double + 1;
static_assertions::const_assert!(
sp_std::mem::size_of::<Double>() - sp_std::mem::size_of::<Single>() == SHIFT / 8
core::mem::size_of::<Double>() - core::mem::size_of::<Single>() == SHIFT / 8
);
/// Splits a [`Double`] limb number into a tuple of two [`Single`] limb numbers.
@@ -438,9 +439,9 @@ impl BigUint {
}
}
impl sp_std::fmt::Debug for BigUint {
impl core::fmt::Debug for BigUint {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(
f,
"BigUint {{ {:?} ({:?})}}",
@@ -450,7 +451,7 @@ impl sp_std::fmt::Debug for BigUint {
}
#[cfg(not(feature = "std"))]
fn fmt(&self, _: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
fn fmt(&self, _: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
Ok(())
}
}