Skip to content

Commit 7449831

Browse files
FreezyLemonYeungOnion
authored andcommitted
refactor: reduce MSRV to 1.61
1 parent 207e27d commit 7449831

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

Cargo.lock.MSRV

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ edition = "2021"
1313
include = ["CHANGELOG.md", "LICENSE.md", "src/", "tests/"]
1414

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

1818
[lib]
1919
name = "statrs"

src/distribution/empirical.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,17 @@ impl Empirical {
153153

154154
impl std::fmt::Display for Empirical {
155155
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
156-
if let Some((&NonNan(x), _)) = self.data.first_key_value() {
156+
let mut enumerated_values = self
157+
.data
158+
.iter()
159+
.flat_map(|(&NonNan(x), &count)| std::iter::repeat(x).take(count as usize));
160+
161+
if let Some(x) = enumerated_values.next() {
157162
write!(f, "Empirical([{:.3e}", x)?;
158163
} else {
159164
return write!(f, "Empirical(∅)");
160165
}
161166

162-
let mut enumerated_values = self
163-
.data
164-
.iter()
165-
.flat_map(|(&NonNan(x), &count)| std::iter::repeat(x).take(count as usize))
166-
.skip(1);
167-
168167
for val in enumerated_values.by_ref().take(4) {
169168
write!(f, ", {:.3e}", val)?;
170169
}

0 commit comments

Comments
 (0)