diff --git a/Cargo.toml b/Cargo.toml index 50c9fc88836f..a3582fbda133 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -542,6 +542,8 @@ default-members = [ [workspace.lints.rust] suspicious_double_ref_op = { level = "allow", priority = 2 } +# `substrate_runtime` is a common `cfg` condition name used in the repo. +unexpected_cfgs = { level = "allow", check-cfg = ['cfg(substrate_runtime)'] } [workspace.lints.clippy] all = { level = "allow", priority = 0 } diff --git a/substrate/frame/support/src/lib.rs b/substrate/frame/support/src/lib.rs index 4864059167a9..e1e1e0153de0 100644 --- a/substrate/frame/support/src/lib.rs +++ b/substrate/frame/support/src/lib.rs @@ -869,7 +869,6 @@ macro_rules! hypothetically_ok { pub use serde::{Deserialize, Serialize}; #[doc(hidden)] -#[cfg(not(no_std))] pub use macro_magic; /// Prelude to be used for pallet testing, for ease of use. diff --git a/substrate/frame/support/src/storage/generator/map.rs b/substrate/frame/support/src/storage/generator/map.rs index b41f9c717167..7a74308fdeac 100644 --- a/substrate/frame/support/src/storage/generator/map.rs +++ b/substrate/frame/support/src/storage/generator/map.rs @@ -74,47 +74,6 @@ pub trait StorageMap { } } -/// Utility to iterate through items in a storage map. -pub struct StorageMapIterator { - prefix: Vec, - previous_key: Vec, - drain: bool, - _phantom: ::core::marker::PhantomData<(K, V, Hasher)>, -} - -impl Iterator - for StorageMapIterator -{ - type Item = (K, V); - - fn next(&mut self) -> Option<(K, V)> { - loop { - let maybe_next = sp_io::storage::next_key(&self.previous_key) - .filter(|n| n.starts_with(&self.prefix)); - break match maybe_next { - Some(next) => { - self.previous_key = next; - match unhashed::get::(&self.previous_key) { - Some(value) => { - if self.drain { - unhashed::kill(&self.previous_key) - } - let mut key_material = - Hasher::reverse(&self.previous_key[self.prefix.len()..]); - match K::decode(&mut key_material) { - Ok(key) => Some((key, value)), - Err(_) => continue, - } - }, - None => continue, - } - }, - None => None, - } - } - } -} - impl> storage::IterableStorageMap for G where G::Hasher: ReversibleStorageHasher, diff --git a/substrate/primitives/runtime-interface/src/lib.rs b/substrate/primitives/runtime-interface/src/lib.rs index d6dcb69958af..1de8543c461d 100644 --- a/substrate/primitives/runtime-interface/src/lib.rs +++ b/substrate/primitives/runtime-interface/src/lib.rs @@ -15,9 +15,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Custom inner attributes are unstable, so we need to faky disable the attribute. -// rustfmt still honors the attribute to not format the rustdocs below. -#![cfg_attr(feature = "never", rustfmt::skip)] //! Substrate runtime interface //! //! This crate provides types, traits and macros around runtime interfaces. A runtime interface is diff --git a/substrate/primitives/weights/src/weight_v2.rs b/substrate/primitives/weights/src/weight_v2.rs index 3c10929f433b..0f92e6448ca9 100644 --- a/substrate/primitives/weights/src/weight_v2.rs +++ b/substrate/primitives/weights/src/weight_v2.rs @@ -401,14 +401,14 @@ where } } -#[cfg(any(test, feature = "std", feature = "runtime-benchmarks"))] +#[cfg(any(test, feature = "std"))] impl From for Weight { fn from(value: u64) -> Self { Self::from_parts(value, value) } } -#[cfg(any(test, feature = "std", feature = "runtime-benchmarks"))] +#[cfg(any(test, feature = "std"))] impl From<(u64, u64)> for Weight { fn from(value: (u64, u64)) -> Self { Self::from_parts(value.0, value.1)