Skip to content

Commit

Permalink
cleanup small things
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiyoshika committed Nov 9, 2023
1 parent 4f3755f commit 0e483a2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/html5/parser/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@ impl Document {
.position(|&child_id| child_id == reference_node)
.unwrap();

if parent.children.len() > idx + 1 {
return Some(parent.children[idx + 1]);
let next_idx = idx + 1;
if parent.children.len() > next_idx {
return Some(parent.children[next_idx]);
}

None
Expand Down Expand Up @@ -444,9 +445,7 @@ impl Document {
if let Some(node) = self.get_node_by_id(node_id) {
for child_id in &node.children {
if let Some(child) = self.get_node_by_id(*child_id) {
if child.name == tag {
return true;
}
return child.name == tag;
}
}
}
Expand Down Expand Up @@ -728,7 +727,7 @@ impl DocumentHandle {
Ok(())
}

fn check_query_predicate(
fn matches_query_condition(
&self,
doc_read: &Document,
current_node: &Node,
Expand Down Expand Up @@ -808,7 +807,7 @@ impl DocumentHandle {
let mut predicate_result: bool = true;

for condition in &query.conditions {
if !self.check_query_predicate(&doc_read, current_node, condition) {
if !self.matches_query_condition(&doc_read, current_node, condition) {
predicate_result = false;
break;
}
Expand Down

0 comments on commit 0e483a2

Please sign in to comment.