Apply more suggestions.
This commit is contained in:
@@ -114,18 +114,15 @@ impl<'x> RematchObject<'x> for PlainText<'x> {
|
||||
recognize(one_of::<&str, &str, CustomError<_>>(" \t")),
|
||||
line_ending,
|
||||
))))(goal);
|
||||
match is_whitespace {
|
||||
Ok((new_goal, _)) => {
|
||||
let (new_remaining, _) = many1(org_space_or_line_ending)(remaining)?;
|
||||
remaining = new_remaining;
|
||||
goal = new_goal;
|
||||
continue;
|
||||
}
|
||||
Err(_) => {}
|
||||
};
|
||||
if let Ok((new_goal, _)) = is_whitespace {
|
||||
let (new_remaining, _) = many1(org_space_or_line_ending)(remaining)?;
|
||||
remaining = new_remaining;
|
||||
goal = new_goal;
|
||||
continue;
|
||||
}
|
||||
|
||||
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Target does not match.".into(),
|
||||
"Target does not match.",
|
||||
))));
|
||||
}
|
||||
|
||||
@@ -144,6 +141,7 @@ mod tests {
|
||||
use nom::combinator::map;
|
||||
|
||||
use super::*;
|
||||
use crate::context::bind_context;
|
||||
use crate::context::Context;
|
||||
use crate::context::ContextElement;
|
||||
use crate::context::GlobalSettings;
|
||||
@@ -158,8 +156,9 @@ mod tests {
|
||||
let initial_context = ContextElement::document_context();
|
||||
let initial_context = Context::new(&global_settings, List::new(&initial_context));
|
||||
let (remaining, result) = map(
|
||||
parser_with_context!(plain_text(detect_standard_set_object_sans_plain_text))(
|
||||
&initial_context,
|
||||
bind_context!(
|
||||
plain_text(detect_standard_set_object_sans_plain_text),
|
||||
&initial_context
|
||||
),
|
||||
Object::PlainText,
|
||||
)(input)
|
||||
|
||||
Reference in New Issue
Block a user