Skip to content

Commit 1b59971

Browse files
committed
Refactored Rng+RngCore without Clone
1 parent 81e9f20 commit 1b59971

File tree

30 files changed

+148
-112
lines changed

30 files changed

+148
-112
lines changed

necsim/core/src/cogs/active_lineage_sampler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use core::ops::ControlFlow;
33
use necsim_core_bond::{NonNegativeF64, PositiveF64};
44

55
use super::{
6-
CoalescenceSampler, DispersalSampler, EmigrationExit, EventSampler, Habitat, ImmigrationEntry,
7-
LineageStore, MathsCore, Rng, SpeciationProbability, TurnoverRate,
6+
Backup, CoalescenceSampler, DispersalSampler, EmigrationExit, EventSampler, Habitat,
7+
ImmigrationEntry, LineageStore, MathsCore, Rng, SpeciationProbability, TurnoverRate,
88
};
99

1010
use crate::{lineage::Lineage, simulation::partial::active_lineage_sampler::PartialSimulation};
@@ -24,7 +24,7 @@ pub trait ActiveLineageSampler<
2424
N: SpeciationProbability<M, H>,
2525
E: EventSampler<M, H, G, S, X, D, C, T, N>,
2626
I: ImmigrationEntry<M>,
27-
>: crate::cogs::Backup + core::fmt::Debug
27+
>: Backup + core::fmt::Debug
2828
{
2929
type LineageIterator<'a>: Iterator<Item = &'a Lineage>
3030
where

necsim/core/src/cogs/coalescence_sampler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::{
1616
#[allow(clippy::inline_always, clippy::inline_fn_without_body)]
1717
#[contract_trait]
1818
pub trait CoalescenceSampler<M: MathsCore, H: Habitat<M>, S: LineageStore<M, H>>:
19-
crate::cogs::Backup + core::fmt::Debug
19+
Backup + core::fmt::Debug
2020
{
2121
#[must_use]
2222
#[debug_requires(habitat.get_habitat_at_location(&location) > 0, "location is habitable")]

necsim/core/src/cogs/dispersal_sampler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use necsim_core_bond::ClosedUnitF64;
22

33
use crate::{
4-
cogs::{MathsCore, Rng},
4+
cogs::{Backup, MathsCore, Rng},
55
landscape::Location,
66
};
77

@@ -12,7 +12,7 @@ use super::Habitat;
1212
#[allow(clippy::module_name_repetitions)]
1313
#[contract_trait]
1414
pub trait DispersalSampler<M: MathsCore, H: Habitat<M>, G: Rng<M>>:
15-
crate::cogs::Backup + core::fmt::Debug
15+
Backup + core::fmt::Debug
1616
{
1717
#[must_use]
1818
#[debug_requires(habitat.is_location_habitable(location), "location is habitable")]

necsim/core/src/cogs/emigration_exit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use necsim_core_bond::{NonNegativeF64, PositiveF64};
22

33
use crate::{
4-
cogs::{Habitat, LineageStore, MathsCore, Rng},
4+
cogs::{Backup, Habitat, LineageStore, MathsCore, Rng},
55
landscape::{IndexedLocation, Location},
66
lineage::GlobalLineageReference,
77
simulation::partial::emigration_exit::PartialSimulation,
@@ -15,7 +15,7 @@ use crate::{
1515
#[allow(clippy::no_effect_underscore_binding)]
1616
#[contract_trait]
1717
pub trait EmigrationExit<M: MathsCore, H: Habitat<M>, G: Rng<M>, S: LineageStore<M, H>>:
18-
crate::cogs::Backup + core::fmt::Debug
18+
Backup + core::fmt::Debug
1919
{
2020
#[must_use]
2121
#[debug_ensures(match &ret {

necsim/core/src/cogs/event_sampler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use necsim_core_bond::PositiveF64;
22

33
use super::{
4-
CoalescenceSampler, DispersalSampler, EmigrationExit, Habitat, LineageStore, MathsCore, Rng,
5-
SpeciationProbability, TurnoverRate,
4+
Backup, CoalescenceSampler, DispersalSampler, EmigrationExit, Habitat, LineageStore, MathsCore,
5+
Rng, SpeciationProbability, TurnoverRate,
66
};
77
use crate::{
88
event::{DispersalEvent, SpeciationEvent},
@@ -28,7 +28,7 @@ pub trait EventSampler<
2828
C: CoalescenceSampler<M, H, S>,
2929
T: TurnoverRate<M, H>,
3030
N: SpeciationProbability<M, H>,
31-
>: crate::cogs::Backup + core::fmt::Debug
31+
>: Backup + core::fmt::Debug
3232
{
3333
#[must_use]
3434
fn sample_event_for_lineage_at_event_time_or_emigrate<

necsim/core/src/cogs/habitat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ use necsim_core_bond::OffByOneU64;
22

33
use crate::landscape::{IndexedLocation, LandscapeExtent, Location};
44

5-
use super::{MathsCore, Rng};
5+
use super::{Backup, MathsCore, Rng};
66

77
#[allow(
88
clippy::inline_always,
99
clippy::inline_fn_without_body,
1010
clippy::no_effect_underscore_binding
1111
)]
1212
#[contract_trait]
13-
pub trait Habitat<M: MathsCore>: crate::cogs::Backup + core::fmt::Debug + Sized {
13+
pub trait Habitat<M: MathsCore>: Backup + core::fmt::Debug {
1414
type LocationIterator<'a>: Iterator<Item = Location> + 'a
1515
where
1616
Self: 'a;

necsim/core/src/cogs/immigration_entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::lineage::MigratingLineage;
22

3-
use super::MathsCore;
3+
use super::{Backup, MathsCore};
44

55
#[allow(clippy::inline_always, clippy::inline_fn_without_body)]
66
#[contract_trait]
7-
pub trait ImmigrationEntry<M: MathsCore>: crate::cogs::Backup + core::fmt::Debug {
7+
pub trait ImmigrationEntry<M: MathsCore>: Backup + core::fmt::Debug {
88
#[must_use]
99
fn next_optional_immigration(&mut self) -> Option<MigratingLineage>;
1010

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use core::hash::Hash;
22

3-
use super::{Habitat, MathsCore};
3+
use super::{Backup, Habitat, MathsCore};
44

55
#[allow(clippy::module_name_repetitions)]
66
pub trait LineageReference<M: MathsCore, H: Habitat<M>>:
7-
crate::cogs::Backup + PartialEq + Eq + Hash + core::fmt::Debug
7+
Backup + PartialEq + Eq + Hash + core::fmt::Debug
88
{
99
}

necsim/core/src/cogs/lineage_store.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
use core::ops::Index;
22

3-
use super::{Habitat, LineageReference, MathsCore};
3+
use super::{Backup, Habitat, LineageReference, MathsCore};
44
use crate::{
55
landscape::{IndexedLocation, Location},
66
lineage::{GlobalLineageReference, Lineage},
77
};
88

99
#[allow(clippy::inline_always, clippy::inline_fn_without_body)]
1010
#[contract_trait]
11-
pub trait LineageStore<M: MathsCore, H: Habitat<M>>:
12-
crate::cogs::Backup + Sized + core::fmt::Debug
13-
{
11+
pub trait LineageStore<M: MathsCore, H: Habitat<M>>: Backup + Sized + core::fmt::Debug {
1412
type LocalLineageReference: LineageReference<M, H>;
1513

1614
#[must_use]

necsim/core/src/cogs/rng.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
landscape::IndexedLocation,
88
};
99

10-
pub trait Rng<M: MathsCore>: Backup + Clone + core::fmt::Debug {
10+
pub trait Rng<M: MathsCore>: Backup + core::fmt::Debug {
1111
type Generator: RngCore;
1212
type Sampler;
1313

@@ -21,9 +21,7 @@ pub trait Rng<M: MathsCore>: Backup + Clone + core::fmt::Debug {
2121
}
2222

2323
#[allow(clippy::module_name_repetitions)]
24-
pub trait RngCore:
25-
crate::cogs::Backup + Sized + Clone + core::fmt::Debug + Serialize + DeserializeOwned
26-
{
24+
pub trait RngCore: Backup + Sized + core::fmt::Debug + Serialize + DeserializeOwned {
2725
type Seed: AsMut<[u8]> + Default + Sized;
2826

2927
#[must_use]

0 commit comments

Comments
 (0)