Skip to content

Commit 09f7b2d

Browse files
KiChjanggodcodehunter
authored andcommitted
Properly implement Debug on bounded types (paritytech#11659)
1 parent 82db8dc commit 09f7b2d

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

primitives/runtime/src/bounded/bounded_btree_map.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,12 @@ where
182182
}
183183
}
184184

185-
#[cfg(feature = "std")]
186-
impl<K, V, S> std::fmt::Debug for BoundedBTreeMap<K, V, S>
185+
impl<K, V, S> sp_std::fmt::Debug for BoundedBTreeMap<K, V, S>
187186
where
188-
BTreeMap<K, V>: std::fmt::Debug,
187+
BTreeMap<K, V>: sp_std::fmt::Debug,
189188
S: Get<u32>,
190189
{
191-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
190+
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
192191
f.debug_tuple("BoundedBTreeMap").field(&self.0).field(&Self::bound()).finish()
193192
}
194193
}

primitives/runtime/src/bounded/bounded_btree_set.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,12 @@ where
159159
}
160160
}
161161

162-
#[cfg(feature = "std")]
163-
impl<T, S> std::fmt::Debug for BoundedBTreeSet<T, S>
162+
impl<T, S> sp_std::fmt::Debug for BoundedBTreeSet<T, S>
164163
where
165-
BTreeSet<T>: std::fmt::Debug,
164+
BTreeSet<T>: sp_std::fmt::Debug,
166165
S: Get<u32>,
167166
{
168-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
167+
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
169168
f.debug_tuple("BoundedBTreeSet").field(&self.0).field(&Self::bound()).finish()
170169
}
171170
}

primitives/runtime/src/bounded/bounded_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ impl<T, S> Default for BoundedVec<T, S> {
598598

599599
impl<T, S> sp_std::fmt::Debug for BoundedVec<T, S>
600600
where
601-
T: sp_std::fmt::Debug,
601+
Vec<T>: sp_std::fmt::Debug,
602602
S: Get<u32>,
603603
{
604604
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {

primitives/runtime/src/bounded/weak_bounded_vec.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,12 @@ impl<T, S> Default for WeakBoundedVec<T, S> {
168168
}
169169
}
170170

171-
#[cfg(feature = "std")]
172-
impl<T, S> std::fmt::Debug for WeakBoundedVec<T, S>
171+
impl<T, S> sp_std::fmt::Debug for WeakBoundedVec<T, S>
173172
where
174-
T: std::fmt::Debug,
173+
Vec<T>: sp_std::fmt::Debug,
175174
S: Get<u32>,
176175
{
177-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
176+
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
178177
f.debug_tuple("WeakBoundedVec").field(&self.0).field(&Self::bound()).finish()
179178
}
180179
}

0 commit comments

Comments
 (0)