diff --git a/Cargo.toml b/Cargo.toml index a31a745c..0e5c693e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,13 @@ homepage = "https://github.com/ForwardSimulation/forrustts" repository = "https://github.com/ForwardSimulation/forrustts" keywords = ["simulation", "tree_sequences", "tskit", "population_genetics"] +# Added for rust >= 1.80.0 +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_cfg)'] } + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "doc_cfg"] [workspace] members = [ diff --git a/forrustts-core/src/lib.rs b/forrustts-core/src/lib.rs index b6e73a05..14fa1d1b 100644 --- a/forrustts-core/src/lib.rs +++ b/forrustts-core/src/lib.rs @@ -2,7 +2,6 @@ #![warn(missing_docs)] #![warn(rustdoc::broken_intra_doc_links)] -#![cfg_attr(doc_cfg, feature(doc_cfg))] use thiserror::Error; diff --git a/forrustts-genetics/src/genetic_maps.rs b/forrustts-genetics/src/genetic_maps.rs index 4b2900b9..f5aaf9ee 100644 --- a/forrustts-genetics/src/genetic_maps.rs +++ b/forrustts-genetics/src/genetic_maps.rs @@ -15,20 +15,24 @@ pub enum Breakpoint { IndependentAssortment(Position), } +impl Breakpoint { + fn as_position(&self) -> Position { + match self { + Breakpoint::IndependentAssortment(p) => *p, + Breakpoint::Crossover(p) => *p, + } + } +} + impl From for Position { fn from(value: Breakpoint) -> Self { - match value { - Breakpoint::IndependentAssortment(p) => p, - Breakpoint::Crossover(p) => p, - } + value.as_position() } } impl PartialOrd for Breakpoint { fn partial_cmp(&self, other: &Self) -> Option { - let left = Position::from(*self); - let right = Position::from(*other); - left.partial_cmp(&right) + Some(self.as_position().cmp(&other.as_position())) } } diff --git a/forrustts-genetics/src/lib.rs b/forrustts-genetics/src/lib.rs index 343244a1..439d8d2d 100644 --- a/forrustts-genetics/src/lib.rs +++ b/forrustts-genetics/src/lib.rs @@ -11,20 +11,20 @@ pub use genetic_maps::GeneticMapStatus; pub use genetic_maps::IndependentAssortment; pub use genetic_maps::PoissonCrossover; -#[cfg(test)] -mod tests { - use super::*; - use rand::Rng; - - struct MyGeneticMap {} - - impl GenerateBreakpoints for MyGeneticMap { - fn generate_breakpoints(&mut self, _rng: &mut T) {} - fn breakpoints(&self) -> &[Breakpoint] { - &[] - } - } -} +// #[cfg(test)] +// mod tests { +// use super::*; +// use rand::Rng; +// +// struct MyGeneticMap {} +// +// impl GenerateBreakpoints for MyGeneticMap { +// fn generate_breakpoints(&mut self, _rng: &mut T) {} +// fn breakpoints(&self) -> &[Breakpoint] { +// &[] +// } +// } +// } #[test] fn test_poisson_crossover() {