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