stratisd/0002-deps-update-rand-to-0.4.patch

51 lines
1.6 KiB
Diff
Raw Normal View History

From b68c392d3d44b7d5ec1877b935f0ea7f1d26bb6d 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..1939910 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()
.iter_mut()
.fold(false,
|acc, b| acc | b.save_state(&stamp_time, metadata).is_ok());
--
2.15.1