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()) }) } }