avoid collecting columns to a temporary vec

pull/9647/head
Pascal Kuthe 6 months ago committed by Michael Davis
parent 6ccbfe9bdf
commit 408282097f
No known key found for this signature in database

4
Cargo.lock generated

@ -1779,9 +1779,9 @@ dependencies = [
[[package]] [[package]]
name = "nucleo" name = "nucleo"
version = "0.4.1" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6350a138d8860658523a7593cbf6813999d17a099371d14f70c5c905b37593e9" checksum = "5262af4c94921c2646c5ac6ff7900c2af9cbb08dc26a797e18130a7019c039d4"
dependencies = [ dependencies = [
"nucleo-matcher", "nucleo-matcher",
"parking_lot", "parking_lot",

@ -38,7 +38,7 @@ package.helix-term.opt-level = 2
[workspace.dependencies] [workspace.dependencies]
tree-sitter = { version = "0.22" } tree-sitter = { version = "0.22" }
nucleo = "0.4.1" nucleo = "0.5.0"
slotmap = "1.0.7" slotmap = "1.0.7"
thiserror = "1.0" thiserror = "1.0"

@ -15,7 +15,7 @@ use crate::{
use futures_util::future::BoxFuture; use futures_util::future::BoxFuture;
use helix_event::AsyncHook; use helix_event::AsyncHook;
use nucleo::pattern::{CaseMatching, Normalization}; use nucleo::pattern::{CaseMatching, Normalization};
use nucleo::{Config, Nucleo, Utf32String}; use nucleo::{Config, Nucleo};
use thiserror::Error; use thiserror::Error;
use tokio::sync::mpsc::Sender; use tokio::sync::mpsc::Sender;
use tui::{ use tui::{
@ -135,14 +135,9 @@ fn inject_nucleo_item<T, D>(
item: T, item: T,
editor_data: &D, editor_data: &D,
) { ) {
let column_texts: Vec<Utf32String> = columns injector.push(item, |item, dst| {
.iter() for (column, text) in columns.iter().filter(|column| column.filter).zip(dst) {
.filter(|column| column.filter) *text = column.format_text(item, editor_data).into()
.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;
} }
}); });
} }

Loading…
Cancel
Save