rust-discovery: type alias for random generator seed
authorGeorges Racinet <georges.racinet@octobus.net>
Mon, 23 Dec 2019 17:47:31 +0100
changeset 44042 2abffea40700
parent 44041 fa808e65eabb
child 44043 b958419b6c53
rust-discovery: type alias for random generator seed It just makes our life easier Differential Revision: https://phab.mercurial-scm.org/D7715
rust/hg-core/src/discovery.rs
--- 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 {