Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Debug to match Display #195

Merged
merged 1 commit into from Mar 5, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/bigint.rs
Expand Up @@ -59,7 +59,6 @@ impl Neg for Sign {
}

/// A big signed integer type.
#[derive(Debug)]
pub struct BigInt {
sign: Sign,
data: BigUint,
Expand Down Expand Up @@ -137,6 +136,12 @@ impl Default for BigInt {
}
}

impl fmt::Debug for BigInt {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f)
}
}

impl fmt::Display for BigInt {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad_integral(!self.is_negative(), "", &self.data.to_str_radix(10))
Expand Down
7 changes: 6 additions & 1 deletion src/biguint.rs
Expand Up @@ -35,7 +35,6 @@ pub(crate) use self::convert::to_str_radix_reversed;
pub use self::iter::{U32Digits, U64Digits};

/// A big unsigned integer type.
#[derive(Debug)]
pub struct BigUint {
data: Vec<BigDigit>,
}
Expand Down Expand Up @@ -106,6 +105,12 @@ impl Default for BigUint {
}
}

impl fmt::Debug for BigUint {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f)
}
}

impl fmt::Display for BigUint {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad_integral(true, "", &self.to_str_radix(10))
Expand Down