Skip to content

Commit

Permalink
Fix clippy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
zolkko committed Jul 8, 2024
1 parent 8bf242c commit 1096a5a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ where
let z = s / var_s.sqrt();

// Limit range to fix computational errors
Ok((tau_b.max(-1.0).min(1.0), z))
Ok((tau_b.clamp(-1.0, 1.0), z))
}

#[inline]
Expand Down Expand Up @@ -320,7 +320,7 @@ mod tests {
];

let (tau_b, z) = tau_b_with_comparator(&x, &y, |a: &f64, b: &f64| {
a.partial_cmp(&b).unwrap_or(Ordering::Greater)
a.partial_cmp(b).unwrap_or(Ordering::Greater)
})
.unwrap();

Expand All @@ -330,7 +330,7 @@ mod tests {

#[test]
fn shifted_test() {
let comparator = |a: &f64, b: &f64| a.partial_cmp(&b).unwrap_or(Ordering::Greater);
let comparator = |a: &f64, b: &f64| a.partial_cmp(b).unwrap_or(Ordering::Greater);

let x = &[1.0, 1.0, 2.0, 2.0, 3.0, 3.0];
let y = &[1.0, 2.0, 2.0, 3.0, 3.0, 4.0];
Expand Down Expand Up @@ -371,7 +371,7 @@ mod tests {

assert_eq!(
tau_b_with_comparator(x, y, |a: &f64, b: &f64| a
.partial_cmp(&b)
.partial_cmp(b)
.unwrap_or(Ordering::Greater)),
Ok((expected_tau_b, expected_z))
);
Expand All @@ -387,7 +387,7 @@ mod tests {

assert_eq!(
tau_b_with_comparator(&x, &y, |a: &f64, b: &f64| a
.partial_cmp(&b)
.partial_cmp(b)
.unwrap_or(Ordering::Greater)),
Ok((0.0, 0.0))
);
Expand Down Expand Up @@ -436,7 +436,7 @@ mod tests {

let result = std::panic::catch_unwind(|| {
let (_tau, _significance) = tau_b_with_comparator(&x, &y, |a: &f64, b: &f64| {
a.partial_cmp(&b).unwrap_or(Ordering::Greater)
a.partial_cmp(b).unwrap_or(Ordering::Greater)
})
.unwrap();
});
Expand Down

0 comments on commit 1096a5a

Please sign in to comment.