From 4eb6648ba0a67d260edf676c680473cd43b48172 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Fri, 9 Aug 2024 18:01:37 +0200 Subject: [PATCH] Fix linter warnings --- src/destructured.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/destructured.rs b/src/destructured.rs index 90b7955..f8d22d9 100644 --- a/src/destructured.rs +++ b/src/destructured.rs @@ -67,7 +67,7 @@ where /// If the key is not found, return the index where it should be /// inserted. fn index(&self, key: &K) -> usize { - match self.keys.binary_search(&key) { + match self.keys.binary_search(key) { Ok(i) => i, Err(i) => { if i >= self.keys.len() { @@ -101,11 +101,7 @@ where (start..end) .filter_map(|i| { let key = &self.keys[i]; - if let Some(fields) = self.hashmap.get(key) { - Some((key.clone(), fields)) - } else { - None - } + self.hashmap.get(key).map(|fields| (key.clone(), fields)) }) .collect() }