Skip to content

Commit

Permalink
fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
magiclen committed Nov 26, 2023
1 parent e444b6d commit cf841ce
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,25 @@ impl Display for UnitParseError {
{
f.write_fmt(format_args!(", {expected_character:?}"))?;
}

if *also_expect_no_character {
f.write_fmt(format_args!(
", {expected_character:?} or no character",
expected_character = expected_characters[expected_characters_length - 1]
))?;
} else {
f.write_fmt(format_args!(
" or {expected_character:?} is expected)",
expected_character = expected_characters[expected_characters_length - 1]
))?;
}
}

if *also_expect_no_character {
f.write_fmt(format_args!(
", {expected_character:?} or no character is expected)",
expected_character = expected_characters[expected_characters_length - 1]
))
} else {
f.write_fmt(format_args!(
" or {expected_character:?} is expected)",
expected_character = expected_characters[expected_characters_length - 1]
))
f.write_str(" or no character")?;
}

f.write_str(" is expected)")
}
}
}
Expand Down

0 comments on commit cf841ce

Please sign in to comment.