From 8bf242c167e97f3c20cd2c8a6af4415f442a0ede Mon Sep 17 00:00:00 2001 From: zolkko Date: Mon, 8 Jul 2024 21:21:48 +0200 Subject: [PATCH 1/2] Fix crate's version in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e6ca6c0..98b1244 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Add this to your Cargo.toml: ```toml [dependencies] -kendalls = "0.2.1" +kendalls = "0.2.2" ``` and this to your crate root: From 1096a5a32c636b436fe65effd13c43494a4f8c5a Mon Sep 17 00:00:00 2001 From: zolkko Date: Mon, 8 Jul 2024 21:29:44 +0200 Subject: [PATCH 2/2] Fix clippy warnings. --- src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 00f1ddb..fe335c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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] @@ -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(); @@ -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]; @@ -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)) ); @@ -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)) ); @@ -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(); });