From df81642c9eab661257340838a5e5f2ba175c6307 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Tue, 12 Nov 2024 21:07:43 +0530 Subject: [PATCH] Update tui/src/filter.rs Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com> --- tui/src/filter.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tui/src/filter.rs b/tui/src/filter.rs index 60a64223..bc62bfa7 100644 --- a/tui/src/filter.rs +++ b/tui/src/filter.rs @@ -93,12 +93,9 @@ impl Filter { } else { let input = self.search_input.iter().collect::().to_lowercase(); self.items.iter().find_map(|item| { - let item_name_lower = &item.node.name.to_lowercase(); - if item_name_lower.starts_with(&input) { - Some(item_name_lower[input.len()..].to_string()) - } else { - None - } + let item_name_lower = item.node.name.to_lowercase(); + (item_name_lower.starts_with(&input)) + .then_some(item_name_lower[input.len()..].to_string()) }) } }