Skip to content

Commit 549febb

Browse files
committed
Move PartialOrd bound to SampleRange, not uses
1 parent 10d6eb3 commit 549febb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/distributions/range.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use distributions::{Distribution, Uniform01, Rand};
3838
/// let m: f64 = range(-40.0f64, 1.3e5f64, &mut rng);
3939
/// println!("{}", m);
4040
/// ```
41-
pub fn range<T: PartialOrd + SampleRange, R: Rng+?Sized>(low: T, high: T, rng: &mut R) -> T {
41+
pub fn range<T: SampleRange, R: Rng+?Sized>(low: T, high: T, rng: &mut R) -> T {
4242
assert!(low < high, "distributions::range called with low >= high");
4343
SampleRange::construct_range(low, high).sample(rng)
4444
}
@@ -90,7 +90,7 @@ pub struct Range<X> {
9090
pub zone: X
9191
}
9292

93-
impl<X: SampleRange + PartialOrd> Range<X> {
93+
impl<X: SampleRange> Range<X> {
9494
/// Create a new `Range` instance that samples uniformly from
9595
/// `[low, high)`. Panics if `low >= high`.
9696
pub fn new(low: X, high: X) -> Range<X> {
@@ -108,7 +108,7 @@ impl<T: SampleRange> Distribution<T> for Range<T> {
108108
/// The helper trait for types that have a sensible way to sample
109109
/// uniformly between two values. This should not be used directly,
110110
/// and is only to facilitate `Range`.
111-
pub trait SampleRange : Sized {
111+
pub trait SampleRange : PartialOrd+Sized {
112112
/// Construct the `Range` object that `sample_range`
113113
/// requires. This should not ever be called directly, only via
114114
/// `Range::new`, which will check that `low < high`, so this

0 commit comments

Comments
 (0)