From ec755704b2ca2d9c3c580a00bd132f580969b9dd Mon Sep 17 00:00:00 2001 From: andypymont Date: Sat, 4 Feb 2023 22:14:15 +0000 Subject: [PATCH] Resolve clippy::if-not-else warning - See https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6831a1e..d7f31ad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,9 +56,7 @@ fn parse_time(val: &str, postfix: &str) -> f64 { pub fn parse_exec_time(output: &str) -> f64 { output.lines().fold(0_f64, |acc, l| { - if !l.contains("elapsed:") { - acc - } else { + if l.contains("elapsed:") { let timing = l.split("(elapsed: ").last().unwrap(); // use `contains` istd. of `ends_with`: string may contain ANSI escape sequences. // for possible time formats, see: https://github.com/rust-lang/rust/blob/1.64.0/library/core/src/time.rs#L1176-L1200 @@ -73,6 +71,8 @@ pub fn parse_exec_time(output: &str) -> f64 { } else { acc } + } else { + acc } }) }