sp-std -> core (#3199)

First in a series of PRs that reduces our use of sp-std with a view to
deprecating it.

This is just looking at /substrate and moving some of the references
from `sp-std` to `core`.
These particular changes should be uncontroversial.

Where macros are used `::core` should be used to remove any ambiguity.

part of https://github.com/paritytech/polkadot-sdk/issues/2101
This commit is contained in:
Squirrel
2024-02-06 13:01:29 +00:00
committed by GitHub
parent c552fb5495
commit bc2e5e1fe2
75 changed files with 125 additions and 125 deletions
@@ -22,7 +22,7 @@
//! multiplication implementation provided there.
use crate::{biguint, Rounding};
use sp_std::cmp::{max, min};
use core::cmp::{max, min};
/// Helper gcd function used in Rational128 implementation.
pub fn gcd(a: u128, b: u128) -> u128 {
@@ -18,6 +18,9 @@
//! Primitive traits for the runtime arithmetic.
use codec::HasCompact;
use core::ops::{
Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, RemAssign, Shl, Shr, Sub, SubAssign,
};
pub use ensure::{
ensure_pow, Ensure, EnsureAdd, EnsureAddAssign, EnsureDiv, EnsureDivAssign,
EnsureFixedPointNumber, EnsureFrom, EnsureInto, EnsureMul, EnsureMulAssign, EnsureOp,
@@ -28,9 +31,6 @@ pub use num_traits::{
checked_pow, Bounded, CheckedAdd, CheckedDiv, CheckedMul, CheckedNeg, CheckedRem, CheckedShl,
CheckedShr, CheckedSub, One, Signed, Unsigned, Zero,
};
use sp_std::ops::{
Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, RemAssign, Shl, Shr, Sub, SubAssign,
};
use crate::MultiplyRational;
@@ -262,7 +262,7 @@ pub trait Saturating {
Self: One,
{
let mut o = Self::one();
sp_std::mem::swap(&mut o, self);
core::mem::swap(&mut o, self);
*self = o.saturating_add(One::one());
}
@@ -272,7 +272,7 @@ pub trait Saturating {
Self: One,
{
let mut o = Self::one();
sp_std::mem::swap(&mut o, self);
core::mem::swap(&mut o, self);
*self = o.saturating_sub(One::one());
}
@@ -282,7 +282,7 @@ pub trait Saturating {
Self: One,
{
let mut o = Self::one();
sp_std::mem::swap(&mut o, self);
core::mem::swap(&mut o, self);
*self = o.saturating_add(amount);
}
@@ -292,7 +292,7 @@ pub trait Saturating {
Self: One,
{
let mut o = Self::one();
sp_std::mem::swap(&mut o, self);
core::mem::swap(&mut o, self);
*self = o.saturating_sub(amount);
}
}
@@ -949,7 +949,7 @@ mod ensure {
}
}
impl sp_std::ops::Mul for Signum {
impl core::ops::Mul for Signum {
type Output = Self;
fn mul(self, rhs: Self) -> Self {