diff --git a/src/main.rs b/src/main.rs index 9f0accc..6e54d63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -215,15 +215,11 @@ fn handle_request(config: &Config, request: &Request) -> String { } fn select_nodes(node: &Node, kinds: &[String], new_ranges: &mut Vec) { - if kinds.iter().any(|kind| kind == node.kind()) { - new_ranges.push(node.range()); - } else { - for child in tree::named_children(&node) { - if kinds.iter().any(|kind| kind == child.kind()) { - new_ranges.push(child.range()); - } else { - select_nodes(&child, kinds, new_ranges); - } + for child in tree::named_children(&node) { + if kinds.iter().any(|kind| kind == child.kind()) { + new_ranges.push(child.range()); + } else { + select_nodes(&child, kinds, new_ranges); } } }