From dc69367e9b92b78ebbcd4b838af2c5675f6c1170 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Dec 2020 07:45:43 +0000 Subject: [PATCH 1/3] Update rand requirement from 0.7 to 0.8 Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version. - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand/compare/0.7.0...0.8.0) Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 433d823..89c4538 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ nom = { version = "6", optional = true } criterion = "0.3" futures-executor = "0.3.4" hex = "0.4" -rand = "0.7" +rand = "0.8" quickcheck = "0.9" [[bench]] From d602b49b3575b1731b290e7a6387a28af0f9f62a Mon Sep 17 00:00:00 2001 From: Max Inden Date: Mon, 11 Jan 2021 11:37:01 +0100 Subject: [PATCH 2/3] Cargo.toml: Update to quickcheck 1.0.1 and remove rand dependency With `quickcheck` `v1` `rand` is no longer part of `quickcheck`s public API interface. More concretely `Gen` is now a `struct` with a minimal API. `Arbitrary` implementations should (/must) delegate to `Arbitrary` implementations of primitives instead of making use the random number generator directly. See https://github.com/BurntSushi/quickcheck/pull/265 for details. --- Cargo.toml | 3 +-- tests/io.rs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 89c4538..90e9b40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,8 +29,7 @@ nom = { version = "6", optional = true } criterion = "0.3" futures-executor = "0.3.4" hex = "0.4" -rand = "0.8" -quickcheck = "0.9" +quickcheck = "1" [[bench]] name = "benchmark" diff --git a/tests/io.rs b/tests/io.rs index 3ed5624..1ca9f33 100644 --- a/tests/io.rs +++ b/tests/io.rs @@ -18,7 +18,6 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. use quickcheck::{Arbitrary, Gen}; -use rand::Rng; use unsigned_varint::encode; #[cfg(feature = "std")] @@ -107,8 +106,8 @@ impl RandomUvi { } impl Arbitrary for RandomUvi { - fn arbitrary(g: &mut G) -> Self { - let n: u128 = g.gen(); + fn arbitrary(g: &mut Gen) -> Self { + let n: u128 = Arbitrary::arbitrary(g); match n % 6 { 0 => { let mut b = encode::u8_buffer(); From 6eecca3d1a8266c9ab4283d1f61378173ae340f9 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Mon, 11 Jan 2021 12:13:40 +0100 Subject: [PATCH 3/3] tests/identity: Use Gen instead of StdThreadGen --- src/codec.rs | 2 +- tests/identity.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/codec.rs b/src/codec.rs index 1576a88..606dcc0 100644 --- a/src/codec.rs +++ b/src/codec.rs @@ -103,7 +103,7 @@ pub struct UviBytes { varint_codec: Uvi, /// number of bytes expected in the current frame (for decoding only) len: Option, - // maximum permitted number of bytes per frame + /// maximum permitted number of bytes per frame max: usize, _ty: PhantomData } diff --git a/tests/identity.rs b/tests/identity.rs index 2924de7..1d31b43 100644 --- a/tests/identity.rs +++ b/tests/identity.rs @@ -105,7 +105,7 @@ fn various() { #[test] fn identity_codec() { use bytes::{Bytes, BytesMut}; - use quickcheck::StdThreadGen; + use quickcheck::Gen; use tokio_util::codec::{Encoder, Decoder}; use unsigned_varint::codec::UviBytes; @@ -118,7 +118,7 @@ fn identity_codec() { input == codec.decode(&mut buffer).expect("Ok").expect("Some").freeze() } - QuickCheck::with_gen(StdThreadGen::new(512 * 1024)) + QuickCheck::new().gen(Gen::new(512 * 1024)) .quickcheck(prop as fn(Vec) -> bool) }