From c8d5f00d7cad7b11ce1d17479f290b8016471f25 Mon Sep 17 00:00:00 2001 From: Age Date: Wed, 3 Oct 2018 21:57:21 +1000 Subject: [PATCH] Improve split function --- beacon_chain/transition/src/delegation/validator.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/beacon_chain/transition/src/delegation/validator.rs b/beacon_chain/transition/src/delegation/validator.rs index 0dc0d5f16..9c6019d72 100644 --- a/beacon_chain/transition/src/delegation/validator.rs +++ b/beacon_chain/transition/src/delegation/validator.rs @@ -37,7 +37,10 @@ fn honey_badger_split(list: &Vec, n: usize) -> Vec> { let mut split_list: Vec> = vec![]; let list_length = list.len(); for i in 0..n { - let partition = list.get(list_length*i/n..list_length*(i+1)/n).unwrap(); // cannot go out of bounds + let partition = match list.get(list_length*i/n..list_length*(i+1)/n) { + Some(v) => v, + None => unreachable!(), + }; split_list.push(partition.to_vec()); } split_list