Patchwork D7715: rust-discovery: type alias for random generator seed

login
register
mail settings
Submitter phabricator
Date Jan. 9, 2020, 2:57 p.m.
Message ID <d577e976f9302bec54cc79e9baffd0d9@localhost.localdomain>
Download mbox | patch
Permalink /patch/44231/
State Not Applicable
Headers show

Comments

phabricator - Jan. 9, 2020, 2:57 p.m.
Closed by commit rHG2abffea40700: rust-discovery: type alias for random generator seed (authored by gracinet).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7715?vs=18923&id=19126

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7715/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7715

AFFECTED FILES
  rust/hg-core/src/discovery.rs

CHANGE DETAILS




To: gracinet, #hg-reviewers, Alphare, pulkit
Cc: durin42, kevincox, mercurial-devel

Patch

diff --git a/rust/hg-core/src/discovery.rs b/rust/hg-core/src/discovery.rs
--- a/rust/hg-core/src/discovery.rs
+++ b/rust/hg-core/src/discovery.rs
@@ -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 {