Skip to content

Commit

Permalink
chore: Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejKastak committed Apr 12, 2024
1 parent a6beb7d commit 8031fc4
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions yari-sys/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,27 +236,31 @@ fn arguments(input: &str) -> IResult<&str, Vec<Argument>> {
fn function_call(input: &str) -> IResult<&str, (&str, Vec<Argument>)> {
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> {
Expand Down Expand Up @@ -313,14 +317,17 @@ fn string_operation(input: &str) -> IResult<&str, (StrOperation, &str, Option<i6
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
// Check if we still have unconsumed input and return error if so
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 complex_value(input: &str) -> IResult<&str, &str> {
Expand Down

0 comments on commit 8031fc4

Please sign in to comment.