66982ba85f
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
51 lines
1.6 KiB
Diff
51 lines
1.6 KiB
Diff
From 48adfc646f088f7b94cbbb912dee71e2068d6dd6 Mon Sep 17 00:00:00 2001
|
|
From: Igor Gnatenko <ignatenko@redhat.com>
|
|
Date: Fri, 5 Jan 2018 21:38:12 +0100
|
|
Subject: [PATCH 2/6] deps: update rand to 0.4
|
|
|
|
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
|
|
---
|
|
Cargo.toml | 2 +-
|
|
src/engine/strat_engine/blockdevmgr.rs | 5 +++--
|
|
2 files changed, 4 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/Cargo.toml b/Cargo.toml
|
|
index 5d7fceb..cab096a 100644
|
|
--- a/Cargo.toml
|
|
+++ b/Cargo.toml
|
|
@@ -13,7 +13,7 @@ byteorder = "0.3.13"
|
|
chrono = "0.4"
|
|
macro-attr = "0.2.0"
|
|
term = "0.4"
|
|
-rand = "0.3.10"
|
|
+rand = "0.4"
|
|
serde = "1"
|
|
serde_derive = "1"
|
|
serde_json = "1"
|
|
diff --git a/src/engine/strat_engine/blockdevmgr.rs b/src/engine/strat_engine/blockdevmgr.rs
|
|
index 21996fe..3d13fda 100644
|
|
--- a/src/engine/strat_engine/blockdevmgr.rs
|
|
+++ b/src/engine/strat_engine/blockdevmgr.rs
|
|
@@ -9,7 +9,7 @@ use std::fs::{File, OpenOptions};
|
|
use std::path::{Path, PathBuf};
|
|
|
|
use chrono::{DateTime, Duration, Utc};
|
|
-use rand::{thread_rng, sample};
|
|
+use rand::{thread_rng, seq};
|
|
use uuid::Uuid;
|
|
|
|
use devicemapper::{Bytes, Device, IEC, Sectors, Segment};
|
|
@@ -203,7 +203,8 @@ impl BlockDevMgr {
|
|
|
|
// TODO: consider making selection not entirely random, i.e, ensuring
|
|
// distribution of metadata over different paths.
|
|
- let saved = sample(&mut thread_rng(), candidates, MAX_NUM_TO_WRITE)
|
|
+ let saved = seq::sample_iter(&mut thread_rng(), candidates, MAX_NUM_TO_WRITE)
|
|
+ .unwrap_or_else(|e| e)
|
|
.iter_mut()
|
|
.fold(false,
|
|
|acc, b| acc | b.save_state(&stamp_time, metadata).is_ok());
|
|
--
|
|
2.15.1
|
|
|