Simplify headline_end and section_end now that eof is a special case.

This commit is contained in:
Tom Alexander 2023-04-10 11:17:55 -04:00
parent cbe7ef4030
commit 204f319a92
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -129,7 +129,7 @@ fn section<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Sec
#[tracing::instrument(ret, level = "debug")] #[tracing::instrument(ret, level = "debug")]
fn section_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> { fn section_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
let headline_matcher = parser_with_context!(headline)(context); let headline_matcher = parser_with_context!(headline)(context);
alt((recognize(headline_matcher), eof))(input) recognize(headline_matcher)(input)
} }
#[tracing::instrument(ret, level = "debug")] #[tracing::instrument(ret, level = "debug")]
@ -181,5 +181,5 @@ fn headline<'r, 's>(
#[tracing::instrument(ret, level = "debug")] #[tracing::instrument(ret, level = "debug")]
fn headline_end<'r, 's>(_context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> { fn headline_end<'r, 's>(_context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
alt((line_ending, eof))(input) line_ending(input)
} }