Skip to content

Commit

Permalink
Use let-else syntax to reduce indentation in fuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 27, 2023
1 parent 455ca39 commit b539d5a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fuzz/fuzz_targets/parse_token_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ fn main() {
}

fn do_fuzz(bytes: &[u8]) {
if bytes.len() < 200 {
if let Ok(string) = str::from_utf8(bytes) {
_ = string.parse::<proc_macro2::TokenStream>();
}
}
let ..=199 = bytes.len() else { return };
let Ok(string) = str::from_utf8(bytes) else { return };
let _ = string.parse::<proc_macro2::TokenStream>();
}

0 comments on commit b539d5a

Please sign in to comment.