chore: simplify expressions

pull/24376/head
Stuart Carnie 2023-06-08 12:37:12 +10:00
parent 7bd2a7bfdb
commit 7111ea0eed
No known key found for this signature in database
GPG Key ID: 848D9C9718D78B4F
2 changed files with 3 additions and 12 deletions

View File

@ -260,10 +260,7 @@ pub fn parse_conditional_expression(input: &str) -> Result<ConditionalExpression
let mut i: &str = input;
// Consume whitespace from the input
i = match ws0(i) {
Ok((i1, _)) => i1,
_ => unreachable!("ws0 is infallible"),
};
(i, _) = ws0(i).expect("ws0 is infallible");
if i.is_empty() {
return Err(ParseError {
@ -293,10 +290,7 @@ pub fn parse_conditional_expression(input: &str) -> Result<ConditionalExpression
};
// Consume remaining whitespace from the input
i = match ws0(i) {
Ok((i1, _)) => i1,
_ => unreachable!("ws0 is infallible"),
};
(i, _) = ws0(i).expect("ws0 is infallible");
if !i.is_empty() {
return Err(ParseError {

View File

@ -69,10 +69,7 @@ pub fn parse_statements(input: &str) -> ParseResult {
loop {
// Consume whitespace from the input
i = match ws0(i) {
Ok((i1, _)) => i1,
_ => unreachable!("ws0 is infallible"),
};
(i, _) = ws0(i).expect("ws0 is infallible");
if eof::<_, nom::error::Error<_>>(i).is_ok() {
return Ok(res);