Apply more suggestions.

This commit is contained in:
Tom Alexander
2023-10-16 17:28:28 -04:00
parent b4f9a3b9b6
commit 1d329cc310
8 changed files with 43 additions and 45 deletions

View File

@@ -139,14 +139,7 @@ fn pathreg<'b, 'g, 'r, 's>(
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, PathReg<'s>> {
let (remaining, path) = map_parser(
escaped(
take_till1(|c| match c {
'\\' | '[' | ']' => true,
_ => false,
}),
'\\',
anychar,
),
escaped(take_till1(|c| matches!(c, '\\' | '[' | ']')), '\\', anychar),
parser_with_context!(parse_path_reg)(context),
)(input)?;
Ok((remaining, path))
@@ -262,11 +255,8 @@ fn apply_link_templates<'b, 'g, 'r, 's>(
};
}
// Handle lingering state
match state {
ParserState::Percent => {
ret.push('%');
}
_ => {}
if let ParserState::Percent = state {
ret.push('%');
}
if !injected_value {
ret.push_str(inject_value);
@@ -494,6 +484,6 @@ fn impl_path_reg_end<'b, 'g, 'r, 's>(
}
Err(nom::Err::Error(CustomError::MyError(MyError(
"No path reg end".into(),
"No path reg end",
))))
}