From 8b6efb38e9f6db9ea84bf530e2d244985260a98b Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Sat, 11 Jun 2022 21:09:21 +0530 Subject: [PATCH] Refactor textobject node capture (#2741) --- helix-core/src/syntax.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index ca497b6482294..8d7520c3d1313 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -308,13 +308,7 @@ impl TextObjectQuery { let nodes: Vec<_> = mat .captures .iter() - .filter_map(|x| { - if x.index == capture_idx { - Some(x.node) - } else { - None - } - }) + .filter_map(|cap| (cap.index == capture_idx).then(|| cap.node)) .collect(); if nodes.len() > 1 {