Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Properly implement Debug on bounded types
  • Loading branch information
KiChjang committed Jun 13, 2022
commit cba7243360c4630974c69d3a9fa7b4c6ff8f9105
7 changes: 3 additions & 4 deletions primitives/runtime/src/bounded/bounded_btree_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,12 @@ where
}
}

#[cfg(feature = "std")]
impl<K, V, S> std::fmt::Debug for BoundedBTreeMap<K, V, S>
impl<K, V, S> sp_std::fmt::Debug for BoundedBTreeMap<K, V, S>
where
BTreeMap<K, V>: std::fmt::Debug,
BTreeMap<K, V>: sp_std::fmt::Debug,
S: Get<u32>,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
f.debug_tuple("BoundedBTreeMap").field(&self.0).field(&Self::bound()).finish()
}
}
Expand Down
7 changes: 3 additions & 4 deletions primitives/runtime/src/bounded/bounded_btree_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,12 @@ where
}
}

#[cfg(feature = "std")]
impl<T, S> std::fmt::Debug for BoundedBTreeSet<T, S>
impl<T, S> sp_std::fmt::Debug for BoundedBTreeSet<T, S>
where
BTreeSet<T>: std::fmt::Debug,
BTreeSet<T>: sp_std::fmt::Debug,
S: Get<u32>,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
f.debug_tuple("BoundedBTreeSet").field(&self.0).field(&Self::bound()).finish()
}
}
Expand Down
2 changes: 1 addition & 1 deletion primitives/runtime/src/bounded/bounded_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ impl<T, S> Default for BoundedVec<T, S> {

impl<T, S> sp_std::fmt::Debug for BoundedVec<T, S>
where
T: sp_std::fmt::Debug,
Vec<T>: sp_std::fmt::Debug,
S: Get<u32>,
{
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
Expand Down
7 changes: 3 additions & 4 deletions primitives/runtime/src/bounded/weak_bounded_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,12 @@ impl<T, S> Default for WeakBoundedVec<T, S> {
}
}

#[cfg(feature = "std")]
impl<T, S> std::fmt::Debug for WeakBoundedVec<T, S>
impl<T, S> sp_std::fmt::Debug for WeakBoundedVec<T, S>
where
T: std::fmt::Debug,
Vec<T>: sp_std::fmt::Debug,
S: Get<u32>,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
f.debug_tuple("WeakBoundedVec").field(&self.0).field(&Self::bound()).finish()
}
}
Expand Down