From 72b2119a34af99dffd88044a55253d4229dfc669 Mon Sep 17 00:00:00 2001 From: Victor Song Date: Fri, 30 Sep 2022 23:43:14 -0400 Subject: [PATCH] Simplify boolean assertions in tests --- src/fs/filter.rs | 16 ++++++++-------- src/options/parser.rs | 2 +- src/output/tree.rs | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/fs/filter.rs b/src/fs/filter.rs index 84f607c..4cd08b0 100644 --- a/src/fs/filter.rs +++ b/src/fs/filter.rs @@ -346,31 +346,31 @@ mod test_ignores { #[test] fn empty_matches_nothing() { let pats = IgnorePatterns::empty(); - assert_eq!(false, pats.is_ignored("nothing")); - assert_eq!(false, pats.is_ignored("test.mp3")); + assert!(!pats.is_ignored("nothing")); + assert!(!pats.is_ignored("test.mp3")); } #[test] fn ignores_a_glob() { let (pats, fails) = IgnorePatterns::parse_from_iter(vec![ "*.mp3" ]); assert!(fails.is_empty()); - assert_eq!(false, pats.is_ignored("nothing")); - assert_eq!(true, pats.is_ignored("test.mp3")); + assert!(!pats.is_ignored("nothing")); + assert!(pats.is_ignored("test.mp3")); } #[test] fn ignores_an_exact_filename() { let (pats, fails) = IgnorePatterns::parse_from_iter(vec![ "nothing" ]); assert!(fails.is_empty()); - assert_eq!(true, pats.is_ignored("nothing")); - assert_eq!(false, pats.is_ignored("test.mp3")); + assert!(pats.is_ignored("nothing")); + assert!(!pats.is_ignored("test.mp3")); } #[test] fn ignores_both() { let (pats, fails) = IgnorePatterns::parse_from_iter(vec![ "nothing", "*.mp3" ]); assert!(fails.is_empty()); - assert_eq!(true, pats.is_ignored("nothing")); - assert_eq!(true, pats.is_ignored("test.mp3")); + assert!(pats.is_ignored("nothing")); + assert!(pats.is_ignored("test.mp3")); } } diff --git a/src/options/parser.rs b/src/options/parser.rs index ca0029b..7f6e388 100644 --- a/src/options/parser.rs +++ b/src/options/parser.rs @@ -743,6 +743,6 @@ mod matches_test { fn no_count() { let flags = MatchedFlags { flags: Vec::new(), strictness: Strictness::UseLastArguments }; - assert_eq!(flags.has(&COUNT).unwrap(), false); + assert!(!flags.has(&COUNT).unwrap()); } } diff --git a/src/output/tree.rs b/src/output/tree.rs index 360a8c4..5e27e20 100644 --- a/src/output/tree.rs +++ b/src/output/tree.rs @@ -257,15 +257,15 @@ mod iter_test { let next = iter.next().unwrap(); assert_eq!(&"first", next.1); - assert_eq!(false, next.0.last); + assert!(!next.0.last); let next = iter.next().unwrap(); assert_eq!(&"middle", next.1); - assert_eq!(false, next.0.last); + assert!(!next.0.last); let next = iter.next().unwrap(); assert_eq!(&"last", next.1); - assert_eq!(true, next.0.last); + assert!(next.0.last); assert!(iter.next().is_none()); }