Skip to content

Commit

Permalink
Resolve manual_let_else clippy lints
Browse files Browse the repository at this point in the history
    error: this could be rewritten as `let...else`
      --> generate/src/main.rs:50:13
       |
    50 | /             let new = match u8::try_from(chunkmap.len()) {
    51 | |                 Ok(byte) => byte,
    52 | |                 Err(_) => panic!("exceeded 256 unique chunks"),
    53 | |             };
       | |______________^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
       = note: `-D clippy::manual-let-else` implied by `-D clippy::pedantic`
    help: consider writing
       |
    50 ~             let Ok(byte) = u8::try_from(chunkmap.len()) else {
    51 +         $crate::rt::begin_panic($msg)
    52 +     };
       |
  • Loading branch information
dtolnay committed Nov 23, 2022
1 parent 726d043 commit 9c11676
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions generate/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ fn main() {
*prev
} else {
dense.push(chunk);
let new = match u8::try_from(chunkmap.len()) {
Ok(byte) => byte,
Err(_) => panic!("exceeded 256 unique chunks"),
let Ok(new) = u8::try_from(chunkmap.len()) else {
panic!("exceeded 256 unique chunks");
};
chunkmap.insert(chunk, new);
new
Expand Down

0 comments on commit 9c11676

Please sign in to comment.