]> git.lizzy.rs Git - rust.git/blobdiff - src/librand/distributions/mod.rs
Auto merge of #43710 - zackmdavis:field_init_shorthand_power_slam, r=Mark-Simulacrum
[rust.git] / src / librand / distributions / mod.rs
index fb0c9f17cf36737e78f8cd39501b6115800b1ea5..47967a719d397a8972d39bf4e90ac356721af550 100644 (file)
@@ -53,7 +53,7 @@ pub trait Sample<Support> {
 // trait called `Sample` and the other should be `DependentSample`.
 pub trait IndependentSample<Support>: Sample<Support> {
     /// Generate a random value.
-    fn ind_sample<R: Rng>(&self, &mut R) -> Support;
+    fn ind_sample<R: Rng>(&self, _: &mut R) -> Support;
 }
 
 /// A wrapper for generating types that implement `Rand` via the
@@ -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")
@@ -155,7 +149,7 @@ pub fn new(items: &'a mut [Weighted<T>]) -> WeightedChoice<'a, T> {
                 "WeightedChoice::new called with a total weight of 0");
 
         WeightedChoice {
-            items: items,
+            items,
             // we're likely to be generating numbers in this range
             // relatively often, so might as well cache it
             weight_range: Range::new(0, running_total),
@@ -212,12 +206,6 @@ fn ind_sample<R: Rng>(&self, rng: &mut R) -> 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")