diff --git a/substrate/primitives/authorship/src/lib.rs b/substrate/primitives/authorship/src/lib.rs index 254078b844..ac4b5fd315 100644 --- a/substrate/primitives/authorship/src/lib.rs +++ b/substrate/primitives/authorship/src/lib.rs @@ -21,7 +21,9 @@ use sp_std::{prelude::*, result::Result}; -use codec::{Decode, Encode}; +#[cfg(feature = "std")] +use codec::Decode; +use codec::Encode; use sp_inherents::{Error, InherentData, InherentIdentifier, IsFatalError}; use sp_runtime::{traits::Header as HeaderT, RuntimeString}; diff --git a/substrate/primitives/npos-elections/src/assignments.rs b/substrate/primitives/npos-elections/src/assignments.rs index b0dd29dc19..da101e64a7 100644 --- a/substrate/primitives/npos-elections/src/assignments.rs +++ b/substrate/primitives/npos-elections/src/assignments.rs @@ -18,6 +18,7 @@ //! Structs and helpers for distributing a voter's stake among various winners. use crate::{Error, ExtendedBalance, IdentifierT, PerThing128, __OrInvalidIndex}; +#[cfg(feature = "std")] use codec::{Decode, Encode}; use sp_arithmetic::{ traits::{Bounded, Zero}, diff --git a/substrate/utils/prometheus/src/lib.rs b/substrate/utils/prometheus/src/lib.rs index 96407b0062..3753ab9061 100644 --- a/substrate/utils/prometheus/src/lib.rs +++ b/substrate/utils/prometheus/src/lib.rs @@ -15,7 +15,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#[cfg(not(target_os = "unknown"))] use futures_util::{future::Future, FutureExt}; +use prometheus::core::Collector; pub use prometheus::{ self, core::{ @@ -25,7 +27,8 @@ pub use prometheus::{ exponential_buckets, Error as PrometheusError, Histogram, HistogramOpts, HistogramVec, Opts, Registry, }; -use prometheus::{core::Collector, Encoder, TextEncoder}; +#[cfg(not(target_os = "unknown"))] +use prometheus::{Encoder, TextEncoder}; use std::net::SocketAddr; #[cfg(not(target_os = "unknown"))]