Refactor textobject node capture (#2741)

This commit is contained in:
Gokul Soumya 2022-06-11 21:09:21 +05:30 committed by GitHub
parent 9b9c3e5ae2
commit 0b8a00ac96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {