From 14d7f4ddbf3e23100adf8f5e3b50a783f48b0bfd Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 14 Jan 2022 18:08:36 +0100 Subject: [PATCH] Fix a clippy "unnecessary closure" warning Clippy 1.59 beta says: error: unnecessary closure used to substitute value for `Option::None` --> src/properties.rs:119:22 | 119 | let offset = reply | ______________________^ 120 | | .value 121 | | .iter() 122 | | .position(|&v| v == 0) 123 | | .unwrap_or_else(|| reply.value.len()); | |_________________________________________________^ | = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations help: use `unwrap_or` instead | 119 ~ let offset = reply 120 + .value 121 + .iter() 122 ~ .position(|&v| v == 0).unwrap_or(reply.value.len()); | Signed-off-by: Uli Schlachter --- src/properties.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/properties.rs b/src/properties.rs index 17c8ea32..7db1e508 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -120,7 +120,7 @@ impl WmClass { .value .iter() .position(|&v| v == 0) - .unwrap_or_else(|| reply.value.len()); + .unwrap_or(reply.value.len()); Ok(WmClass(reply, offset)) }