diff --git a/Cargo.toml b/Cargo.toml index 4165322..7d7b15c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ lazy_static = { version = "1.2.0", optional = true } log = "0.4" mime = "0.3.14" mime_guess = "2.0.1" -rand = "0.7" +rand = "0.8" safemem = { version = "0.3", optional = true } tempfile = "3" clippy = { version = ">=0.0, <0.1", optional = true} @@ -36,14 +36,14 @@ quick-error = { version = "1.2", optional = true } # Optional Integrations hyper = { version = ">=0.9, <0.11", optional = true, default-features = false } iron = { version = ">=0.4,<0.7", optional = true } -tiny_http = { version = "0.6", optional = true } +tiny_http = { version = "0.8", optional = true } nickel = { version = ">=0.10.1", optional = true } # Only for Rocket example but dev-dependencies can't be optional rocket = { version = "0.4", optional = true } [dev-dependencies] -env_logger = "0.5" +env_logger = "0.8" [features] client = [] diff --git a/src/lib.rs b/src/lib.rs index 7ab4a5b..ce0dd7c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -121,6 +121,7 @@ fn random_alphanumeric(len: usize) -> String { rand::thread_rng() .sample_iter(&rand::distributions::Alphanumeric) .take(len) + .map(|ch| ch as char) .collect() } diff --git a/src/mock.rs b/src/mock.rs index 7d58905..2947661 100644 --- a/src/mock.rs +++ b/src/mock.rs @@ -92,7 +92,7 @@ impl Write for HttpBuffer { } // Simulate the randomness of a network connection by not always reading everything - let len = self.rng.gen_range(1, buf.len() + 1); + let len = self.rng.gen_range(1..=buf.len()); self.buf.write(&buf[..len]) } @@ -159,7 +159,7 @@ impl<'a> Read for ServerRequest<'a> { } // Simulate the randomness of a network connection by not always reading everything - let len = self.rng.gen_range(1, out.len() + 1); + let len = self.rng.gen_range(1..=out.len()); self.data.read(&mut out[..len]) } }