Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
fix: better implementation of Debug, which omits all information that…
Browse files Browse the repository at this point in the history
… shouldn't matter
  • Loading branch information
bgeron committed Mar 1, 2020
1 parent 54ddb08 commit a4092cb
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use std::borrow::Borrow;
use std::borrow::Cow::{self, Borrowed, Owned};
use std::cmp::Ordering;
use std::convert::{From, Into, TryFrom, TryInto};
use std::fmt::Display;
use std::fmt::{Debug, Display};
use std::hash::{Hash, Hasher};
use std::ops::{
Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Rem, RemAssign, Sub, SubAssign,
Expand All @@ -60,9 +60,9 @@ type uint = u32;
#[allow(non_camel_case_types)]
type int = i32;

#[derive(Clone, Debug)]
#[derive(Clone)]
pub struct Uint(Either<uint, Box<BigUint>>);
#[derive(Clone, Debug)]
#[derive(Clone)]
pub struct Int(Either<int, Box<BigInt>>);

impl Uint {
Expand Down Expand Up @@ -215,6 +215,20 @@ impl Display for Int {
}
}

impl Debug for Uint {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
Display::fmt(self, f)
}
}

impl Debug for Int {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
Display::fmt(self, f)
}
}



impl From<BigUint> for Uint {
fn from(v: BigUint) -> Self {
Uint(Right(Box::new(v)))
Expand Down

0 comments on commit a4092cb

Please sign in to comment.