Compare commits

2 Commits

Author SHA1 Message Date
853f177fa8 Small changes for new 2024 edition 2025-02-21 14:09:58 +01:00
fc0efcdc52 Update edition 2025-02-21 14:06:28 +01:00
2 changed files with 6 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
[package]
name = "trueskill-tt"
version = "0.1.0"
edition = "2021"
edition = "2024"
[lib]
bench = false

View File

@@ -82,7 +82,7 @@ where
pub fn key(&self, idx: Index) -> Option<&K> {
self.0
.iter()
.find(|(_, &value)| value == idx)
.find(|&(_, value)| *value == idx)
.map(|(key, _)| key)
}
@@ -115,11 +115,7 @@ fn erfc(x: f64) -> f64 {
let r = t * (-z * z - 1.26551223 + t * h).exp();
if x >= 0.0 {
r
} else {
2.0 - r
}
if x >= 0.0 { r } else { 2.0 - r }
}
fn erfc_inv(mut y: f64) -> f64 {
@@ -147,11 +143,7 @@ fn erfc_inv(mut y: f64) -> f64 {
x += err / (FRAC_2_SQRT_PI * (-(x.powi(2))).exp() - x * err)
}
if y < 1.0 {
x
} else {
-x
}
if y < 1.0 { x } else { -x }
}
fn ppf(p: f64, mu: f64, sigma: f64) -> f64 {
@@ -239,9 +231,9 @@ pub(crate) fn sort_time(xs: &[i64], reverse: bool) -> Vec<usize> {
let mut x = xs.iter().enumerate().collect::<Vec<_>>();
if reverse {
x.sort_by_key(|(_, &x)| Reverse(x));
x.sort_by_key(|&(_, x)| Reverse(x));
} else {
x.sort_by_key(|(_, &x)| x);
x.sort_by_key(|&(_, x)| x);
}
x.into_iter().map(|(i, _)| i).collect()