Skip to content

Commit

Permalink
Remove specialization from Debug implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 20, 2017
1 parent 08c20bb commit 50d36fb
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 49 deletions.
12 changes: 0 additions & 12 deletions src/librand/distributions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ pub struct Weighted<T> {
pub item: T,
}

impl<T> fmt::Debug for Weighted<T> {
default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Weighted")
}
}

impl<T: fmt::Debug> fmt::Debug for Weighted<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Weighted")
Expand Down Expand Up @@ -212,12 +206,6 @@ impl<'a, T: Clone> IndependentSample<T> for WeightedChoice<'a, T> {
}
}

impl<'a, T> fmt::Debug for WeightedChoice<'a, T> {
default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("WeightedChoice")
}
}

impl<'a, T: fmt::Debug> fmt::Debug for WeightedChoice<'a, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("WeightedChoice")
Expand Down
6 changes: 0 additions & 6 deletions src/librand/distributions/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ impl<Sup: SampleRange> IndependentSample<Sup> for Range<Sup> {
}
}

impl<X> fmt::Debug for Range<X> {
default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Range { .. }")
}
}

impl<X: fmt::Debug> fmt::Debug for Range<X> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Range")
Expand Down
24 changes: 0 additions & 24 deletions src/librand/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,6 @@ impl<'a, T: Rand, R: Rng> Iterator for Generator<'a, T, R> {
}
}

impl<'a, T, R> fmt::Debug for Generator<'a, T, R> {
default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Generator { .. }")
}
}

impl<'a, T, R: fmt::Debug> fmt::Debug for Generator<'a, T, R> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Generator")
Expand All @@ -323,12 +317,6 @@ impl<'a, R: Rng> Iterator for AsciiGenerator<'a, R> {
}
}

impl<'a, R> fmt::Debug for AsciiGenerator<'a, R> {
default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("AsciiGenerator { .. }")
}
}

impl<'a, R: fmt::Debug> fmt::Debug for AsciiGenerator<'a, R> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("AsciiGenerator")
Expand Down Expand Up @@ -446,12 +434,6 @@ impl Rand for XorShiftRng {
/// `[0,1)`.
pub struct Open01<F>(pub F);

impl<F> fmt::Debug for Open01<F> {
default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Open01 { .. }")
}
}

impl<F: fmt::Debug> fmt::Debug for Open01<F> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("Open01")
Expand All @@ -468,12 +450,6 @@ impl<F: fmt::Debug> fmt::Debug for Open01<F> {
/// `[0,1)`.
pub struct Closed01<F>(pub F);

impl<F> fmt::Debug for Closed01<F> {
default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Closed01 { .. }")
}
}

impl<F: fmt::Debug> fmt::Debug for Closed01<F> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("Closed01")
Expand Down
8 changes: 1 addition & 7 deletions src/librand/reseeding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,8 @@ impl<S, R: SeedableRng<S>, Rsdr: Reseeder<R> + Default>
}
}

impl<R, Rsdr> fmt::Debug for ReseedingRng<R, Rsdr> {
default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("ReseedingRng { .. }")
}
}

impl<R: fmt::Debug, Rsdr: fmt::Debug> fmt::Debug for ReseedingRng<R, Rsdr> {
default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("ReseedingRng")
.field("rng", &self.rng)
.field("generation_threshold", &self.generation_threshold)
Expand Down

0 comments on commit 50d36fb

Please sign in to comment.