changeset 44042:2abffea40700

rust-discovery: type alias for random generator seed It just makes our life easier Differential Revision: https://phab.mercurial-scm.org/D7715
author Georges Racinet <georges.racinet@octobus.net>
date Mon, 23 Dec 2019 17:47:31 +0100
parents fa808e65eabb
children b958419b6c53
files rust/hg-core/src/discovery.rs
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/discovery.rs	Fri Dec 27 15:53:16 2019 -0800
+++ b/rust/hg-core/src/discovery.rs	Mon Dec 23 17:47:31 2019 +0100
@@ -18,6 +18,7 @@
 use std::collections::{HashSet, VecDeque};
 
 type Rng = rand_pcg::Pcg32;
+type Seed = [u8; 16];
 
 pub struct PartialDiscovery<G: Graph + Clone> {
     target_heads: Option<Vec<Revision>>,
@@ -158,7 +159,7 @@
         respect_size: bool,
         randomize: bool,
     ) -> Self {
-        let mut seed: [u8; 16] = [0; 16];
+        let mut seed = [0; 16];
         if randomize {
             thread_rng().fill_bytes(&mut seed);
         }
@@ -168,7 +169,7 @@
     pub fn new_with_seed(
         graph: G,
         target_heads: Vec<Revision>,
-        seed: [u8; 16],
+        seed: Seed,
         respect_size: bool,
         randomize: bool,
     ) -> Self {