You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-float-ord/0000-Update-to-rand-0.7.patch

52 lines
2.1 KiB

diff -ru float-ord-0.2.0/Cargo.toml float-ord-0.2.0.patched/Cargo.toml
--- float-ord-0.2.0/Cargo.toml 1969-12-31 19:00:00.000000000 -0500
+++ float-ord-0.2.0.patched/Cargo.toml 2020-01-28 16:36:06.742269458 -0500
@@ -20,6 +20,6 @@
license = "MIT / Apache-2.0"
repository = "https://github.com/notriddle/rust-float-ord"
[dev-dependencies.rand]
-version = "0.3"
+version = "0.7"
[badges.travis-ci]
repository = "notriddle/rust-float-ord"
diff -ru float-ord-0.2.0/src/lib.rs float-ord-0.2.0.patched/src/lib.rs
--- float-ord-0.2.0/src/lib.rs 2018-01-30 14:28:28.000000000 -0500
+++ float-ord-0.2.0.patched/src/lib.rs 2020-01-28 17:08:50.441756013 -0500
@@ -78,6 +78,7 @@
extern crate rand;
use self::rand::{Rng, thread_rng};
+ use self::std::iter;
use self::std::prelude::v1::*;
use self::std::collections::hash_map::DefaultHasher;
use self::std::hash::{Hash, Hasher};
@@ -108,8 +109,8 @@
let mut rng = thread_rng();
for n in 0..16 {
for l in 0..16 {
- let v = rng.gen_iter::<f64>()
- .map(|x| x % (1 << l) as i64 as f64)
+ let v = iter::repeat(()).map(|()| rng.gen())
+ .map(|x: f64| x % (1 << l) as i64 as f64)
.take((1 << n))
.collect::<Vec<_>>();
assert!(v.windows(2).all(|w| (w[0] <= w[1]) == (FloatOrd(w[0]) <= FloatOrd(w[1]))));
@@ -140,14 +141,14 @@
let mut rng = thread_rng();
for n in 0..16 {
for l in 0..16 {
- let mut v = rng.gen_iter::<f64>()
- .map(|x| x % (1 << l) as i64 as f64)
+ let mut v = iter::repeat(()).map(|()| rng.gen())
+ .map(|x: f64| x % (1 << l) as i64 as f64)
.take((1 << n))
.collect::<Vec<_>>();
let mut v1 = v.clone();
super::sort(&mut v);
- assert!(v.windows(2).all(|w| w[0] <= w[1]));
+ assert!(v.windows(2).all(|w: &[f64]| w[0] <= w[1]));
v1.sort_by(|a, b| a.partial_cmp(b).unwrap());
assert!(v1.windows(2).all(|w| w[0] <= w[1]));