diff --git a/src/parser/text_element_parser.rs b/src/parser/text_element_parser.rs index 32f42aee..f837bcec 100644 --- a/src/parser/text_element_parser.rs +++ b/src/parser/text_element_parser.rs @@ -41,14 +41,16 @@ use tracing::trace; type UnboundMatcher<'r, I, O, E> = dyn Fn(Context<'r>, I) -> IResult; -fn context_many_till<'r, I, O, E, F>( +fn context_many_till<'r, I, O, E, F, M, T>( context: Context<'r>, - mut many_matcher: &UnboundMatcher<'r, I, O, E>, - mut till_matcher: &UnboundMatcher<'r, I, F, E>, + mut many_matcher: M, + mut till_matcher: T, ) -> impl FnMut(I) -> IResult, F), E> where I: Clone + InputLength, E: ParseError, + M: Fn(Context<'r>, I) -> IResult, + T: Fn(Context<'r>, I) -> IResult, { move |mut i: I| { let mut ret = Vec::new(); @@ -89,7 +91,10 @@ pub fn document(input: &str) -> Res<&str, Vec<(Vec, &str)>> { ret } -pub fn context_paragraph_end<'s, 'r>(context: Context<'r>, input: &str) -> Res<&str, &str> { +pub fn context_paragraph_end<'s, 'r>( + context: Context<'r>, + input: &'s str, +) -> Res<&'s str, &'s str> { paragraph_end(input) } @@ -103,13 +108,8 @@ pub fn paragraph<'s, 'r>( context.with_additional_node(ContextElement::FailMatcherNode(FailMatcherNode { fail_matcher: ChainBehavior::AndParent(Some(¶graph_end)), })); - let ret = { - context_many_till( - ¶graph_context, - &flat_text_element, - &context_paragraph_end, - )(i) - }; + let ret = + { context_many_till(¶graph_context, flat_text_element, context_paragraph_end)(i) }; ret }