Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
mo271 committed Nov 25, 2024
1 parent c5d0fb1 commit ab1d45f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions jxl_test_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
#[macro_export]
macro_rules! assert_almost_eq {
($left:expr, $right:expr, $max_error:expr $(,)?) => {
match (&$left, &$right) {
(left_val, right_val) => {
match (&$left, &$right, &$max_error) {
(left_val, right_val, max_error) => {
let diff = if *left_val > *right_val {
*left_val - *right_val
} else {
*right_val - *left_val
};
if !(diff <= $max_error) {
panic!(
match diff.partial_cmp(max_error) {
Some(std::cmp::Ordering::Greater) | None => panic!(
"assertion failed: `(left ≈ right)`\n left: `{:?}`,\n right: `{:?}`,\n max_error: `{:?}`",
left_val, right_val, $max_error
);
left_val, right_val, max_error
),
_ => {}
}
}
}
Expand Down

0 comments on commit ab1d45f

Please sign in to comment.