From 51214351a851464124effd4923b929ec77b2d82b Mon Sep 17 00:00:00 2001 From: sxyazi Date: Fri, 19 Dec 2025 00:19:32 +0800 Subject: [PATCH] .. --- yazi-plugin/src/utils/layer.rs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/yazi-plugin/src/utils/layer.rs b/yazi-plugin/src/utils/layer.rs index 13f89844..19a82b09 100644 --- a/yazi-plugin/src/utils/layer.rs +++ b/yazi-plugin/src/utils/layer.rs @@ -21,17 +21,20 @@ impl Utils { } let (tx, mut rx) = mpsc::channel::(1); - let mut cands = Vec::with_capacity(t.raw_len()); - - for (i, cand) in t.raw_get::("cands")?.sequence_values::
().enumerate() { - let cand = cand?; - cands.push(Chord { - on: Self::parse_keys(cand.raw_get("on")?)?, - run: vec![relay!(which:callback, [i]).with_any("tx", tx.clone())], - desc: cand.raw_get("desc").ok(), - r#for: None, - }); - } + let cands: Vec<_> = t + .raw_get::
("cands")? + .sequence_values::
() + .enumerate() + .map(|(i, cand)| { + let cand = cand?; + Ok(Chord { + on: Self::parse_keys(cand.raw_get("on")?)?, + run: vec![relay!(which:callback, [i]).with_any("tx", tx.clone())], + desc: cand.raw_get("desc").ok(), + r#for: None, + }) + }) + .collect::>()?; drop(tx); WhichProxy::show(ShowOpt { cands, silent: t.raw_get("silent").unwrap_or_default() });