Rustify some code.
This commit is contained in:
10
src/lib.rs
10
src/lib.rs
@@ -295,8 +295,6 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::f64;
|
||||
|
||||
use approx::{AbsDiffEq, RelativeEq};
|
||||
|
||||
use super::*;
|
||||
@@ -306,12 +304,10 @@ mod tests {
|
||||
impl AbsDiffEq for Rating {
|
||||
type Epsilon = f64;
|
||||
|
||||
#[inline]
|
||||
fn default_epsilon() -> Self::Epsilon {
|
||||
f64::default_epsilon()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool {
|
||||
self.mu.abs_diff_eq(&other.mu, epsilon) && self.sigma.abs_diff_eq(&other.sigma, epsilon)
|
||||
}
|
||||
@@ -338,7 +334,11 @@ mod tests {
|
||||
let alice = Rating::new(MU, SIGMA);
|
||||
let bob = Rating::new(MU, SIGMA);
|
||||
|
||||
assert_relative_eq!(quality(&[&[alice], &[bob]]), 0.4472135954999579, epsilon = EPSILON);
|
||||
assert_relative_eq!(
|
||||
quality(&[&[alice], &[bob]]),
|
||||
0.4472135954999579,
|
||||
epsilon = EPSILON
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user