diff --git a/examples/haploid_wright_fisher.rs b/examples/haploid_wright_fisher.rs index 27053a20d..cf8367d26 100644 --- a/examples/haploid_wright_fisher.rs +++ b/examples/haploid_wright_fisher.rs @@ -64,7 +64,7 @@ fn simulate( let parent_picker = rand::distributions::Uniform::new(0, popsize); let breakpoint_generator = rand::distributions::Uniform::new(0.0, 1.0); let mut rng = rand::rngs::StdRng::seed_from_u64(seed); - let mut bookmark = tskit::types::Bookmark::new(); + let mut bookmark = tskit::types::Bookmark::default(); for birth_time in (0..num_generations).rev() { for c in children.iter_mut() { diff --git a/src/types.rs b/src/types.rs index 30af69ecb..e269b3970 100644 --- a/src/types.rs +++ b/src/types.rs @@ -68,6 +68,12 @@ impl Bookmark { bookmark_setter!(set_provenances, provenances); } +impl Default for Bookmark { + fn default() -> Self { + Self::new() + } +} + #[cfg(test)] mod test { @@ -82,7 +88,7 @@ mod test { #[test] fn test_bookmark_mutability() { - let mut b = Bookmark::new(); + let mut b = Bookmark::default(); assert_eq!(b.offsets.nodes, 0); assert_eq!(b.offsets.edges, 0); assert_eq!(b.offsets.individuals, 0);