From a08fab1a8dced8e442df9b0a3de9e93c3ea84c9f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 27 Nov 2022 00:02:57 -0500 Subject: [PATCH] Remove hrtb attempt. --- src/parser/new_context.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/parser/new_context.rs b/src/parser/new_context.rs index 1fab8d09..87372c3c 100644 --- a/src/parser/new_context.rs +++ b/src/parser/new_context.rs @@ -31,7 +31,7 @@ pub trait NodeType<'p> { impl<'p, T> NodeType<'p> for Node<'p, T> where - T: for<'s> ContextElement<'s>, + T: ContextElement, { fn get_data<'s>(&'s self) -> &dyn ContextElement { &self.data @@ -42,8 +42,8 @@ where } } -pub trait ContextElement<'r> { - fn get_fail_matcher(&self) -> ChainBehavior<'r>; +pub trait ContextElement { + fn get_fail_matcher<'r>(&'r self) -> ChainBehavior<'r>; } struct FailMatcherNode<'r> { @@ -60,14 +60,14 @@ pub enum ChainBehavior<'r> { IgnoreParent(Option<&'r Matcher>), } -impl<'r> ContextElement<'r> for FailMatcherNode<'r> { +impl<'r> ContextElement for FailMatcherNode<'r> { fn get_fail_matcher(&self) -> ChainBehavior<'r> { // TODO: Remove this clone self.fail_matcher.clone() } } -impl<'r> ContextElement<'r> for PreviousElementNode<'r> { +impl<'r> ContextElement for PreviousElementNode<'r> { fn get_fail_matcher(&self) -> ChainBehavior<'r> { ChainBehavior::AndParent(None) } @@ -77,10 +77,7 @@ pub struct ContextTree<'r, T> { head: Option>, } -impl<'r, T> ContextTree<'r, T> -where - T: for<'s> ContextElement<'s>, -{ +impl<'r, T> ContextTree<'r, T> { pub fn new() -> Self { ContextTree { head: None } }