From 9e26d8be7fd8f6dd8c2b9a364e015ab09cb6fc98 Mon Sep 17 00:00:00 2001
From: timofey <tim@ongoteam.yaconnect.com>
Date: Fri, 4 Aug 2023 18:53:00 +0000
Subject: [PATCH] refactor test code

---
 src/func/tests.rs            | 16 ++++++++--------
 src/mrds/trees/unbalanced.rs |  8 ++++----
 src/rstd/atomic/boolean.rs   |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/func/tests.rs b/src/func/tests.rs
index 117ef71..1ec13ae 100644
--- a/src/func/tests.rs
+++ b/src/func/tests.rs
@@ -15,14 +15,14 @@ pub type R = TestResults;
 
 impl R {
     pub fn unwrap(self) {
-        match self {
-            Self {
-                success,
-                total,
-                result: Err(e),
-            } => panic!("failed:\n{success}/{total}\n{e}\n"),
-            _ => (),
-        };
+        if let Self {
+            success,
+            total,
+            result: Err(e),
+        } = self
+        {
+            panic!("failed:\n{success}/{total}\n{e}\n")
+        }
     }
 }
 
diff --git a/src/mrds/trees/unbalanced.rs b/src/mrds/trees/unbalanced.rs
index cc72250..1e74cb2 100644
--- a/src/mrds/trees/unbalanced.rs
+++ b/src/mrds/trees/unbalanced.rs
@@ -179,8 +179,8 @@ mod tests {
             UnbalancedConstructor::rc(Box::new(|node| Box::new(move || Ok(node.clone()))));
         let mut rng = rand::thread_rng();
         let t_set = ctr.from_slice(&mut rng, &[0]);
-        assert!(t_contains(&DefaultComparator, t_set.clone(), 0.into()).is_ok());
-        assert!(t_contains(&DefaultComparator, t_set.clone(), 1.into()).is_err());
+        assert!(t_contains(&DefaultComparator, t_set.clone(), 0).is_ok());
+        assert!(t_contains(&DefaultComparator, t_set.clone(), 1).is_err());
         assert!(
             t_subset_of_t(&DefaultComparator, t_set.clone(), t_set.clone(), None, None).is_ok()
         );
@@ -216,7 +216,7 @@ mod tests {
             let small: Vec<i32> = big
                 .iter()
                 .filter(|x| **x != key && rng.gen_ratio(4, 5))
-                .map(|x| *x)
+                .copied()
                 .collect();
             let t_small = ctr.from_slice(&mut rng, &small);
             let t_big = ctr.from_slice(&mut rng, &big);
@@ -267,7 +267,7 @@ mod tests {
         let small: Vec<i32> = big
             .iter()
             .filter(|x| **x != key && rng.gen_ratio(4, 5))
-            .map(|x| *x)
+            .copied()
             .collect();
         let t_small = ctr.from_slice(&mut rng, &small);
         let t_big = ctr.from_slice(&mut rng, &big);
diff --git a/src/rstd/atomic/boolean.rs b/src/rstd/atomic/boolean.rs
index 1164d52..54faab3 100644
--- a/src/rstd/atomic/boolean.rs
+++ b/src/rstd/atomic/boolean.rs
@@ -74,12 +74,12 @@ mod tests {
 
     #[test]
     fn can_parse_false() {
-        assert_eq!(bool::parse_slice(&[0]).unwrap(), false)
+        assert!(!bool::parse_slice(&[0]).unwrap())
     }
 
     #[test]
     fn can_parse_true() {
-        assert_eq!(bool::parse_slice(&[1]).unwrap(), true)
+        assert!(bool::parse_slice(&[1]).unwrap())
     }
 
     #[test]