Skip to content

Commit

Permalink
refactor: use find
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed Oct 18, 2023
1 parent ed69ba4 commit fbfbb30
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tasks/integrated-benchmark/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ where
eprintln!("Revision {revision:?} is invalid");
panic!("Revision cannot start with a dot");
}
for char in revision.chars() {
if !matches!(char, 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' | '+' | '.' | '~' | '^')
{
eprintln!("Revision {revision:?} is invalid");
panic!("Invalid character: {char:?}");
}
let invalid_char = revision.chars().find(|char| !matches!(char, 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' | '+' | '.' | '~' | '^'));
if let Some(char) = invalid_char {
eprintln!("Revision {revision:?} is invalid");
panic!("Invalid character: {char:?}");
}
}
}

0 comments on commit fbfbb30

Please sign in to comment.