Skip to content

Commit

Permalink
Merge pull request #22 from vbauerster/cosmetic-patch
Browse files Browse the repository at this point in the history
refactor traverse_up_to_node_which_matters
  • Loading branch information
ul authored Jan 24, 2021
2 parents 8c0b6b4 + b9dcc88 commit 863924d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,11 @@ fn traverse_up_to_node_which_matters<'a>(
filetype_config: &FiletypeConfig,
current_node: Node<'a>,
) -> Node<'a> {
let mut node = current_node;
while let Some(parent) = if node.is_named() && filetype_config.is_node_visible(node) {
None
} else {
node.parent()
} {
node = parent;
let mut opt_node = Some(current_node);
while let Some(node) = opt_node.filter(|&n| !(n.is_named() && filetype_config.is_node_visible(n))) {
opt_node = node.parent();
}
node
opt_node.unwrap_or(current_node)
}

fn find_parent_of_interest<'a>(
Expand Down

0 comments on commit 863924d

Please sign in to comment.