Update to rand 0.8
authorColin Walters <walters@verbum.org>
Fri, 11 Mar 2022 20:34:59 +0000 (15:34 -0500)
committerColin Walters <walters@verbum.org>
Fri, 11 Mar 2022 20:34:59 +0000 (15:34 -0500)
Part of general crate updates.

tests/inst/Cargo.toml
tests/inst/src/destructive.rs
tests/inst/src/test.rs
tests/inst/src/treegen.rs

index 884d314f5ef626c7bfd97d6799a94cfec40b9864..3735c1d5e125bedecd8eb9f65a60614f04df4bfc 100644 (file)
@@ -28,7 +28,7 @@ tokio = { version = "1.4.0", features = ["full"] }
 futures-util = "0.3.1"
 base64 = "0.12.0"
 procspawn = "0.8"
-rand = "0.7.3"
+rand = "0.8"
 strum = "0.18.0"
 strum_macros = "0.18.0"
 openat = "0.1.19"
index 6900d3912bbaa56bf8fa5dd3a24cc193c8a509b5..98e1c6878a4a804889a1a9ed165dc2da0f7477d4 100644 (file)
@@ -450,7 +450,7 @@ fn impl_transaction_test<M: AsRef<str>>(
             let ms = std::cmp::min(cycle_time_ms.saturating_mul(20), 24 * 60 * 60 * 1000);
             time::Duration::from_millis(ms)
         } else {
-            time::Duration::from_millis(rng.gen_range(0cycle_time_ms))
+            time::Duration::from_millis(rng.gen_range(0..cycle_time_ms))
         };
         println!(
             "force-reboot-time={:?} cycle={:?} status:{:?}",
index 6f7aa258a56c23d7c22e919c2ae28a0246cacde6..c18dbd2338c08e47b076a84ed722e4edb13a16af 100644 (file)
@@ -91,7 +91,7 @@ pub(crate) async fn http_server<P: AsRef<Path>>(
     ) -> Result<Response<Body>> {
         if let Some(random_delay) = opts.random_delay {
             let slices = 100u32;
-            let n: u32 = rand::thread_rng().gen_range(0slices);
+            let n: u32 = rand::thread_rng().gen_range(0..slices);
             std::thread::sleep((random_delay / slices) * n);
         }
         if opts.basicauth {
index 975db4723b2af77ae8f5948c728ba8edb0596421..2ec4e8492738762c2aaad2edb0569082295acd96 100644 (file)
@@ -62,9 +62,9 @@ pub(crate) fn mutate_one_executable_to(
     let extra = rand::thread_rng()
         .sample_iter(&rand::distributions::Alphanumeric)
         .take(10)
-        .collect::<String>();
+        .collect::<Vec<u8>>();
     destf
-        .write_all(extra.as_bytes())
+        .write_all(&extra)
         .context("Failed to append extra data")?;
     Ok(())
 }