From 1d78cc5a3fe3d13472ed06ce462fc9659442d3e9 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 3 Jun 2023 16:31:37 +0200 Subject: [PATCH] Simplify the check --- src/lib.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a8cbf5d..b53891a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -326,16 +326,10 @@ mod tests { fn test_invalid_input() { let result = from_str("foobar"); println!("{result:?}"); - match result { - Err(ParseDurationError::InvalidInput) => assert!(true), - _ => panic!(), - } + assert_eq!(result, Err(ParseDurationError::InvalidInput)); let result = from_str("invalid 1"); - match result { - Err(ParseDurationError::InvalidInput) => assert!(true), - _ => panic!(), - } + assert_eq!(result, Err(ParseDurationError::InvalidInput)); // Fails for now with a panic /* let result = from_str("777777777777777771m"); match result {