Skip to content

Commit 9611d66

Browse files
committed
Cleanup
1 parent 0aa2418 commit 9611d66

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/mat_ops.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use matches::assert_matches;
2+
13
use opencv::core::{add_mat_mat, ElemMul, Scalar, StsBadArg};
24
use opencv::prelude::*;
35
use opencv::{Error, Result};
@@ -33,7 +35,7 @@ fn mat_ops() -> Result<()> {
3335
let rhs = Mat::new_rows_cols_with_default(3, 3, u8::opencv_type(), 8.into())?;
3436
let rhs2 = Mat::default();
3537
let res = (&lhs + &rhs - &rhs2).into_result();
36-
assert!(matches!(res, Err(Error { code: StsBadArg, .. })));
38+
assert_matches!(res, Err(Error { code: StsBadArg, .. }));
3739
}
3840

3941
// 1st operand error
@@ -42,14 +44,14 @@ fn mat_ops() -> Result<()> {
4244
let rhs = Mat::new_rows_cols_with_default(3, 3, u8::opencv_type(), 8.into())?;
4345
let rhs2 = Mat::new_rows_cols_with_default(3, 3, u8::opencv_type(), 20.into())?;
4446
let res = (&lhs + &rhs - &rhs2).into_result();
45-
assert!(matches!(res, Err(Error { code: StsBadArg, .. })));
47+
assert_matches!(res, Err(Error { code: StsBadArg, .. }));
4648
}
4749

4850
// result + operand error
4951
{
5052
let m = Mat::default();
5153
let res = (&m + &m - (&m + &m)).into_result();
52-
assert!(matches!(res, Err(Error { code: StsBadArg, .. })));
54+
assert_matches!(res, Err(Error { code: StsBadArg, .. }));
5355
assert!(res.err().unwrap().message.starts_with("Both sides of operator have error"));
5456
}
5557

@@ -58,7 +60,7 @@ fn mat_ops() -> Result<()> {
5860
let lhs = Mat::default();
5961
let rhs = Mat::default();
6062
let res = (lhs + rhs).into_result();
61-
assert!(matches!(res, Err(Error { code: StsBadArg, .. })));
63+
assert_matches!(res, Err(Error { code: StsBadArg, .. }));
6264
}
6365

6466
// ElemMul

0 commit comments

Comments
 (0)