Unnamed repository; edit this file 'description' to name the repository.
avoid collecting columns to a temporary vec
| -rw-r--r-- | Cargo.lock | 4 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | helix-term/src/ui/picker.rs | 13 |
3 files changed, 7 insertions, 12 deletions
@@ -1779,9 +1779,9 @@ dependencies = [ [[package]] name = "nucleo" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6350a138d8860658523a7593cbf6813999d17a099371d14f70c5c905b37593e9" +checksum = "5262af4c94921c2646c5ac6ff7900c2af9cbb08dc26a797e18130a7019c039d4" dependencies = [ "nucleo-matcher", "parking_lot", @@ -38,7 +38,7 @@ package.helix-term.opt-level = 2 [workspace.dependencies] tree-sitter = { version = "0.22" } -nucleo = "0.4.1" +nucleo = "0.5.0" slotmap = "1.0.7" thiserror = "1.0" diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 1c47552d..69a87f25 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -15,7 +15,7 @@ use crate::{ use futures_util::future::BoxFuture; use helix_event::AsyncHook; use nucleo::pattern::{CaseMatching, Normalization}; -use nucleo::{Config, Nucleo, Utf32String}; +use nucleo::{Config, Nucleo}; use thiserror::Error; use tokio::sync::mpsc::Sender; use tui::{ @@ -135,14 +135,9 @@ fn inject_nucleo_item<T, D>( item: T, editor_data: &D, ) { - let column_texts: Vec<Utf32String> = columns - .iter() - .filter(|column| column.filter) - .map(|column| column.format_text(&item, editor_data).into()) - .collect(); - injector.push(item, |dst| { - for (i, text) in column_texts.into_iter().enumerate() { - dst[i] = text; + injector.push(item, |item, dst| { + for (column, text) in columns.iter().filter(|column| column.filter).zip(dst) { + *text = column.format_text(item, editor_data).into() } }); } |