Skip to content

Commit

Permalink
refactor: reduce MSRV to 1.61
Browse files Browse the repository at this point in the history
  • Loading branch information
FreezyLemon authored and YeungOnion committed Sep 10, 2024
1 parent 207e27d commit 7449831
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
28 changes: 14 additions & 14 deletions Cargo.lock.MSRV

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = "2021"
include = ["CHANGELOG.md", "LICENSE.md", "src/", "tests/"]

# When changing MSRV: Also update the README
rust-version = "1.66.0"
rust-version = "1.61.0"

[lib]
name = "statrs"
Expand Down
13 changes: 6 additions & 7 deletions src/distribution/empirical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,17 @@ impl Empirical {

impl std::fmt::Display for Empirical {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if let Some((&NonNan(x), _)) = self.data.first_key_value() {
let mut enumerated_values = self
.data
.iter()
.flat_map(|(&NonNan(x), &count)| std::iter::repeat(x).take(count as usize));

if let Some(x) = enumerated_values.next() {
write!(f, "Empirical([{:.3e}", x)?;
} else {
return write!(f, "Empirical(∅)");
}

let mut enumerated_values = self
.data
.iter()
.flat_map(|(&NonNan(x), &count)| std::iter::repeat(x).take(count as usize))
.skip(1);

for val in enumerated_values.by_ref().take(4) {
write!(f, ", {:.3e}", val)?;
}
Expand Down

0 comments on commit 7449831

Please sign in to comment.