avoid collecting columns to a temporary vec
This commit is contained in:
parent
6ccbfe9bdf
commit
408282097f
3 changed files with 7 additions and 12 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -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"
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue