Cleaner implementation.
This commit is contained in:
parent
1506a86d97
commit
804c8fd0b7
@ -43,7 +43,7 @@ where
|
|||||||
|
|
||||||
pub fn with_additional_fail_matcher<G>(
|
pub fn with_additional_fail_matcher<G>(
|
||||||
self,
|
self,
|
||||||
additional_fail_matcher: G,
|
mut additional_fail_matcher: G,
|
||||||
) -> NomContext<
|
) -> NomContext<
|
||||||
impl Clone + for<'o> FnMut(&'o str) -> IResult<&'o str, &'o str, VerboseError<&'o str>>,
|
impl Clone + for<'o> FnMut(&'o str) -> IResult<&'o str, &'o str, VerboseError<&'o str>>,
|
||||||
>
|
>
|
||||||
@ -52,16 +52,12 @@ where
|
|||||||
G: Clone,
|
G: Clone,
|
||||||
{
|
{
|
||||||
let mut old_fail_matcher_clone = self.fail_matcher.clone();
|
let mut old_fail_matcher_clone = self.fail_matcher.clone();
|
||||||
let mut new_context =
|
NomContext {
|
||||||
NomContext::new(move |i| alt((recognize(bold_end), &mut old_fail_matcher_clone))(i));
|
fail_matcher: move |i| {
|
||||||
new_context.can_match_bold = self.can_match_bold;
|
alt((&mut additional_fail_matcher, &mut old_fail_matcher_clone))(i)
|
||||||
new_context.can_match_link = self.can_match_link;
|
},
|
||||||
|
can_match_bold: self.can_match_bold,
|
||||||
// NomContext {
|
can_match_link: self.can_match_link,
|
||||||
// fail_matcher: move |i| alt((additional_fail_matcher, &mut old_fail_matcher_clone))(i),
|
}
|
||||||
// can_match_bold: self.can_match_bold,
|
|
||||||
// can_match_link: self.can_match_link,
|
|
||||||
// }
|
|
||||||
new_context
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user