Resolve clippy::if-not-else warning

- See https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
This commit is contained in:
andypymont 2023-02-04 22:14:15 +00:00
parent fe56f7fb2d
commit ec755704b2

View file

@ -56,9 +56,7 @@ fn parse_time(val: &str, postfix: &str) -> f64 {
pub fn parse_exec_time(output: &str) -> f64 { pub fn parse_exec_time(output: &str) -> f64 {
output.lines().fold(0_f64, |acc, l| { output.lines().fold(0_f64, |acc, l| {
if !l.contains("elapsed:") { if l.contains("elapsed:") {
acc
} else {
let timing = l.split("(elapsed: ").last().unwrap(); let timing = l.split("(elapsed: ").last().unwrap();
// use `contains` istd. of `ends_with`: string may contain ANSI escape sequences. // 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 // 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 { } else {
acc acc
} }
} else {
acc
} }
}) })
} }