From 2edbc029bc39db10e559bd01147fa22c5146e866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Joly?= Date: Sun, 7 Jul 2024 16:20:53 +0000 Subject: [PATCH] style: use unreachable! instead of expect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- rusqlite_migration/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rusqlite_migration/src/lib.rs b/rusqlite_migration/src/lib.rs index d8a9095..0505f69 100644 --- a/rusqlite_migration/src/lib.rs +++ b/rusqlite_migration/src/lib.rs @@ -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")), ), } }