From c9a8a57c4842d0e2b13293f7b96b89fd1581b70f Mon Sep 17 00:00:00 2001 From: MatejKastak Date: Tue, 12 Mar 2024 17:35:32 +0100 Subject: [PATCH] chore: Fix clippy lints --- yari-sys/src/parser.rs | 49 ++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/yari-sys/src/parser.rs b/yari-sys/src/parser.rs index ce1dc9f..7c3e414 100644 --- a/yari-sys/src/parser.rs +++ b/yari-sys/src/parser.rs @@ -236,27 +236,31 @@ fn arguments(input: &str) -> IResult<&str, Vec> { fn function_call(input: &str) -> IResult<&str, (&str, Vec)> { let res = delimited(whitespace, pair(identifier_multi, arguments), whitespace)(input); - if res.is_ok() && !res.as_ref().unwrap().0.is_empty() { - Err(Err::Error(nom::error::Error::new( - res.as_ref().unwrap().0, - ErrorKind::Verify, - ))) - } else { - res + if let Ok(ref inner) = res { + if !inner.0.is_empty() { + return Err(Err::Error(nom::error::Error::new( + inner.0, + ErrorKind::Verify, + ))); + } } + + res } fn value_access(input: &str) -> IResult<&str, &str> { let res = delimited(whitespace, identifier_multi, whitespace)(input); - if res.is_ok() && !res.as_ref().unwrap().0.is_empty() { - Err(Err::Error(nom::error::Error::new( - res.as_ref().unwrap().0, - ErrorKind::Verify, - ))) - } else { - res + if let Ok(ref inner) = res { + if !inner.0.is_empty() { + return Err(Err::Error(nom::error::Error::new( + inner.0, + ErrorKind::Verify, + ))); + } } + + res } fn string_index(input: &str) -> IResult<&str, i64> { @@ -313,14 +317,17 @@ fn string_operation(input: &str) -> IResult<&str, (StrOperation, &str, Option IResult<&str, &str> {