mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
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:
@@ -26,17 +26,16 @@ use crate::{
|
||||
PerThing, Perbill, Rounding, SignedRounding,
|
||||
};
|
||||
use codec::{CompactAs, Decode, Encode};
|
||||
use sp_std::{
|
||||
use core::{
|
||||
fmt::Debug,
|
||||
ops::{self, Add, Div, Mul, Sub},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
#[cfg(all(not(feature = "std"), feature = "serde"))]
|
||||
use sp_std::alloc::string::{String, ToString};
|
||||
use alloc::string::{String, ToString};
|
||||
|
||||
/// Integer types that can be used to interact with `FixedPointNumber` implementations.
|
||||
pub trait FixedPointOperand:
|
||||
@@ -899,9 +898,9 @@ macro_rules! implement_fixed {
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_std::fmt::Debug for $name {
|
||||
impl ::core::fmt::Debug for $name {
|
||||
#[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 {
|
||||
let integral = {
|
||||
let int = self.0 / Self::accuracy();
|
||||
let signum_for_zero = if int == 0 && self.is_negative() { "-" } else { "" };
|
||||
@@ -917,7 +916,7 @@ macro_rules! implement_fixed {
|
||||
}
|
||||
|
||||
#[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(())
|
||||
}
|
||||
}
|
||||
@@ -933,13 +932,13 @@ macro_rules! implement_fixed {
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_std::fmt::Display for $name {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
impl ::core::fmt::Display for $name {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_std::str::FromStr for $name {
|
||||
impl ::core::str::FromStr for $name {
|
||||
type Err = &'static str;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
@@ -969,7 +968,7 @@ macro_rules! implement_fixed {
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
use sp_std::str::FromStr;
|
||||
use ::core::str::FromStr;
|
||||
let s = String::deserialize(deserializer)?;
|
||||
$name::from_str(&s).map_err(de::Error::custom)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user