Skip to content

Commit

Permalink
Implement Display for ValueRange
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolacy committed Aug 17, 2023
1 parent fcb588f commit a5f9a90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/sync/src/range.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{
fmt::{Debug, Formatter},
iter::Sum,
ops::{Add, Mul, Sub},
};
Expand Down Expand Up @@ -269,6 +270,16 @@ where
}
}

// Use Debug output for Display as well
impl<T> std::fmt::Display for ValueRange<T>
where
T: Debug,
{
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}

#[cfg(test)]
mod tests {
use cosmwasm_std::{Decimal, Uint128};
Expand Down
2 changes: 1 addition & 1 deletion packages/sync/src/txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Tx {
}
}

// Use Debug output for display as well (simplify the previous hand-coding of that)
// Use Debug output for Display as well
impl std::fmt::Display for Tx {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
Expand Down

0 comments on commit a5f9a90

Please sign in to comment.