Refactor textobject node capture (#2741)
commit0b8a00ac967f4fd0608d83e2804bb6b1a8bf9c5d
authorGokul Soumya <gokulps15@gmail.com>
dateSat 11 Jun 2022, 21:09 (4 years ago)
parent9b9c3e5
helix-core/src/syntax.rs+1−7
@@ -308,13 +308,7 @@ impl TextObjectQuery {
308308 let nodes: Vec<_> = mat
309309 .captures
310310 .iter()
311− .filter_map(|x| {
312− if x.index == capture_idx {
313− Some(x.node)
314− } else {
315− None
316− }
317− })
311+ .filter_map(|cap| (cap.index == capture_idx).then(|| cap.node))
318312 .collect();
319313
320314 if nodes.len() > 1 {