Remove redundant call to space0.

This commit is contained in:
Tom Alexander 2023-10-17 11:33:26 -04:00
parent 50d2831081
commit f65d0bb82d
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 2 additions and 5 deletions

View File

@ -4,11 +4,9 @@ use nom::bytes::complete::tag;
use nom::bytes::complete::tag_no_case;
use nom::bytes::complete::take_while1;
use nom::character::complete::anychar;
use nom::character::complete::line_ending;
use nom::character::complete::one_of;
use nom::character::complete::space0;
use nom::combinator::consumed;
use nom::combinator::eof;
use nom::combinator::map;
use nom::combinator::not;
use nom::combinator::peek;
@ -24,7 +22,6 @@ use super::util::get_consumed;
use super::util::maybe_consume_trailing_whitespace_if_not_exiting;
use super::util::org_line_ending;
use crate::context::bind_context;
use crate::context::parser_with_context;
use crate::context::RefContext;
use crate::error::CustomError;
use crate::error::Res;
@ -51,7 +48,8 @@ fn _filtered_keyword<'s, F: Fn(OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s
// TODO: When key is a member of org-element-parsed-keywords, value can contain the standard set objects, excluding footnote references.
let (remaining, (consumed_input, (_, _, parsed_key, _))) =
consumed(tuple((space0, tag("#+"), key_parser, tag(":"))))(input)?;
if let Ok((remaining, _)) = tuple((space0::<_, CustomError>, org_line_ending))(remaining) {
let (remaining, _ws) = space0(remaining)?;
if let Ok((remaining, _)) = org_line_ending(remaining) {
return Ok((
remaining,
Keyword {
@ -62,7 +60,6 @@ fn _filtered_keyword<'s, F: Fn(OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s
},
));
}
let (remaining, _ws) = space0(remaining)?;
let (remaining, parsed_value) =
recognize(many_till(anychar, peek(tuple((space0, org_line_ending)))))(remaining)?;
let (remaining, _ws) = tuple((space0, org_line_ending))(remaining)?;