Skip to content

Commit

Permalink
style: remove unused symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-duarte-ifood committed Oct 20, 2023
1 parent d95333a commit 82d23e0
Showing 1 changed file with 25 additions and 36 deletions.
61 changes: 25 additions & 36 deletions merge/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::result;

use matching::Matchings;
use model::CSTNode;

Expand Down Expand Up @@ -49,10 +47,7 @@ pub fn merge(
}
}
(
CSTNode::NonTerminal {
kind,
children: base_children,
},
CSTNode::NonTerminal { kind, .. },
CSTNode::NonTerminal {
children: children_left,
..
Expand Down Expand Up @@ -355,39 +350,37 @@ mod tests {
}

#[test]
fn it_merges_non_terminals_if_only_one_parent_adds_a_node_in_an_initially_empty_children_list() {
fn it_merges_non_terminals_if_only_one_parent_adds_a_node_in_an_initially_empty_children_list()
{
let base = CSTNode::NonTerminal {
kind: "kind".into(),
children: vec![],
};

let initially_empty_parent = CSTNode::NonTerminal {
kind: "kind".into(),
children: vec![],
};

let parent_that_added = CSTNode::NonTerminal {
kind: "kind".into(),
children: vec![
CSTNode::Terminal {
kind: "kind_a".into(),
value: "value_a".into(),
}
],
children: vec![CSTNode::Terminal {
kind: "kind_a".into(),
value: "value_a".into(),
}],
};

let merge = CSTNode::NonTerminal {
kind: "kind".into(),
children: vec![
CSTNode::Terminal {
kind: "kind_a".into(),
value: "value_a".into(),
}
],
children: vec![CSTNode::Terminal {
kind: "kind_a".into(),
value: "value_a".into(),
}],
};

let matchings_base_parent_that_added = ordered_tree_matching(&base, &parent_that_added);
let matchings_base_initially_empty_parent = ordered_tree_matching(&base, &initially_empty_parent);
let matchings_base_initially_empty_parent =
ordered_tree_matching(&base, &initially_empty_parent);
let matchings_parents = ordered_tree_matching(&parent_that_added, &initially_empty_parent);
let merged_tree = super::merge(
&base,
Expand All @@ -414,22 +407,18 @@ mod tests {
fn it_merges_non_terminals_if_only_one_parent_adds_a_node_in_non_empty_children_list() {
let base = CSTNode::NonTerminal {
kind: "kind".into(),
children: vec![
CSTNode::Terminal {
kind: "kind_a".into(),
value: "value_a".into(),
}
],
children: vec![CSTNode::Terminal {
kind: "kind_a".into(),
value: "value_a".into(),
}],
};

let unchanged_parent = CSTNode::NonTerminal {
kind: "kind".into(),
children: vec![
CSTNode::Terminal {
kind: "kind_a".into(),
value: "value_a".into(),
},
],
children: vec![CSTNode::Terminal {
kind: "kind_a".into(),
value: "value_a".into(),
}],
};

let parent_that_added = CSTNode::NonTerminal {
Expand All @@ -442,7 +431,7 @@ mod tests {
CSTNode::Terminal {
kind: "kind_b".into(),
value: "value_b".into(),
}
},
],
};

Expand All @@ -456,7 +445,7 @@ mod tests {
CSTNode::Terminal {
kind: "kind_b".into(),
value: "value_b".into(),
}
},
],
};

Expand Down

0 comments on commit 82d23e0

Please sign in to comment.