Skip to content

Commit

Permalink
[clippy] Push the rock back up the hill
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyr committed Mar 15, 2023
1 parent 110dfee commit 8d10d4e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ impl<'a> SvgLexer<'a> {
fn get_cmd(&mut self, last_cmd: u8) -> Option<u8> {
self.skip_ws();
if let Some(c) = self.get_byte() {
if (b'a'..=b'z').contains(&c) || (b'A'..=b'Z').contains(&c) {
if c.is_ascii_lowercase() || c.is_ascii_uppercase() {
return Some(c);
} else if last_cmd != 0 && (c == b'-' || c == b'.' || (b'0'..=b'9').contains(&c)) {
} else if last_cmd != 0 && (c == b'-' || c == b'.' || c.is_ascii_digit()) {
// Plausible number start
self.unget();
return Some(last_cmd);
Expand Down Expand Up @@ -314,7 +314,7 @@ impl<'a> SvgLexer<'a> {
let mut digit_count = 0;
let mut seen_period = false;
while let Some(c) = self.get_byte() {
if (b'0'..=b'9').contains(&c) {
if c.is_ascii_digit() {
digit_count += 1;
} else if c == b'.' && !seen_period {
seen_period = true;
Expand All @@ -329,11 +329,11 @@ impl<'a> SvgLexer<'a> {
if c == b'-' || c == b'+' {
c = self.get_byte().ok_or(SvgParseError::Wrong)?
}
if !(b'0'..=b'9').contains(&c) {
if c.is_ascii_digit() {
return Err(SvgParseError::Wrong);
}
while let Some(c) = self.get_byte() {
if !(b'0'..=b'9').contains(&c) {
if c.is_ascii_digit() {
self.unget();
break;
}
Expand Down Expand Up @@ -370,7 +370,7 @@ impl<'a> SvgLexer<'a> {

fn get_maybe_relative(&mut self, cmd: u8) -> Result<Point, SvgParseError> {
let pt = self.get_number_pair()?;
if (b'a'..=b'z').contains(&cmd) {
if cmd.is_ascii_lowercase() {
Ok(self.last_pt + pt.to_vec2())
} else {
Ok(pt)
Expand Down

0 comments on commit 8d10d4e

Please sign in to comment.