Skip to content

Commit 4200bd9

Browse files
authored
style: fix rng declaration in test (#814)
1 parent 6888aef commit 4200bd9

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/test_fixtures.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ pub mod simulation {
275275
where
276276
P: Into<Position> + Copy + PartialOrd,
277277
{
278-
let rng = &mut StdRng::seed_from_u64(seed);
278+
let mut rng = StdRng::seed_from_u64(seed);
279279
let intervals: Vec<(Position, Position)> = intervals
280280
.iter()
281281
.map(|(a, b)| ((*a).into(), (*b).into()))
@@ -330,8 +330,8 @@ pub mod simulation {
330330
for t in (0..start_time).rev() {
331331
for i in 0..pop_size {
332332
// select breakpoints
333-
let breakpoint1 = find_breakpoint(rng, seqlen.into());
334-
let breakpoint2 = find_breakpoint(rng, seqlen.into());
333+
let breakpoint1 = find_breakpoint(&mut rng, seqlen.into());
334+
let breakpoint2 = find_breakpoint(&mut rng, seqlen.into());
335335

336336
// find child pop
337337
let mut child_pop = pop_anc;
@@ -340,8 +340,8 @@ pub mod simulation {
340340
}
341341

342342
// find parents
343-
let (parent1, _parent1_pop) = find_parent(rng, &parents, child_pop);
344-
let (parent2, _parent2_pop) = find_parent(rng, &parents, child_pop);
343+
let (parent1, _parent1_pop) = find_parent(&mut rng, &parents, child_pop);
344+
let (parent2, _parent2_pop) = find_parent(&mut rng, &parents, child_pop);
345345

346346
// add individual
347347
let child_ind = add_ind(&mut tables, parent1, parent2);
@@ -367,7 +367,7 @@ pub mod simulation {
367367
] {
368368
add_edge(&mut tables, s, e, p, c);
369369

370-
let mut_pos = find_mutation_pos(rng, s, e);
370+
let mut_pos = find_mutation_pos(&mut rng, s, e);
371371
let mut mut_prob = f64::from(e - s) * mu;
372372
if mut_prob > 1.0 {
373373
mut_prob = 1.0;

tests/test_trees.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ fn test_simplify_treeseq() {
485485
}
486486
}
487487

488-
489488
#[test]
490489
fn test_need_mutation_parents() {
491490
let mut tables = tskit::TableCollection::new(100.).unwrap();

0 commit comments

Comments
 (0)