Don't increment Rc counters when checking exit matchers.
This commit is contained in:
parent
4af09a69a1
commit
c6f75e1736
@ -47,12 +47,8 @@ impl<'r, 's> ContextTree<'r, 's> {
|
|||||||
&'r self,
|
&'r self,
|
||||||
i: &'s str,
|
i: &'s str,
|
||||||
) -> IResult<&'s str, &'s str, VerboseError<&'s str>> {
|
) -> IResult<&'s str, &'s str, VerboseError<&'s str>> {
|
||||||
// TODO: Can I do this without incrementing reference counters? Perhaps via implementing an iterator over the list?
|
for current_node in self.iter() {
|
||||||
let mut current_node = self.tree.clone();
|
let context_element = current_node.get_data();
|
||||||
while !current_node.is_empty() {
|
|
||||||
let context_element = current_node
|
|
||||||
.get_data()
|
|
||||||
.expect("While looop proves its Some()");
|
|
||||||
match context_element {
|
match context_element {
|
||||||
ContextElement::ExitMatcherNode(exit_matcher) => {
|
ContextElement::ExitMatcherNode(exit_matcher) => {
|
||||||
match exit_matcher.exit_matcher {
|
match exit_matcher.exit_matcher {
|
||||||
@ -80,10 +76,7 @@ impl<'r, 's> ContextTree<'r, 's> {
|
|||||||
ContextElement::PreviousElementNode(_) => {}
|
ContextElement::PreviousElementNode(_) => {}
|
||||||
ContextElement::StartOfParagraph => {}
|
ContextElement::StartOfParagraph => {}
|
||||||
};
|
};
|
||||||
|
|
||||||
current_node = current_node.without_front();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make this a custom error
|
// TODO: Make this a custom error
|
||||||
not(take(0usize))(i)?;
|
not(take(0usize))(i)?;
|
||||||
unreachable!()
|
unreachable!()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user