Skip to content

Commit

Permalink
avoid collecting columns to a temporary vec
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe authored and the-mikedavis committed Jul 15, 2024
1 parent 6ccbfe9 commit 4082820
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
13 changes: 4 additions & 9 deletions helix-term/src/ui/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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()
}
});
}
Expand Down

0 comments on commit 4082820

Please sign in to comment.