Skip to content

Commit

Permalink
style: use unreachable! instead of expect
Browse files Browse the repository at this point in the history
Here, we are telling the compiler that we have already performed a check
even though it can’t seem to detect it (for instance, clippy emits a
warning because of the expect).
  • Loading branch information
cljoly committed Jul 7, 2024
1 parent b5892c2 commit 2edbc02
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rusqlite_migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,8 @@ impl<'m> Migrations<'m> {
match self.ms.len() {
0 => SchemaVersion::NoneSet,
v => SchemaVersion::Inside(
NonZeroUsize::new(v).expect("Already checked for 0 in previous match arm"),
NonZeroUsize::new(v)
.unwrap_or_else(|| unreachable!("Already checked for 0 in previous match arm")),
),
}
}
Expand Down

0 comments on commit 2edbc02

Please sign in to comment.