From d74275bda1e20ac432ec0f971dc45fc7685baa0f Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 21 Nov 2026 02:05:58 +0000 Subject: [PATCH] refactor(database): Remove disabled unsound cfg(disable) blocks --- src/database/de.rs | 12 ------------ src/database/util.rs | 16 ---------------- 2 files changed, 28 deletions(-) diff --git a/src/database/de.rs b/src/database/de.rs index 9ff209f0f..0e9d5f5bb 100644 --- a/src/database/de.rs +++ b/src/database/de.rs @@ -472,17 +472,5 @@ impl<'a, 'de: 'a> de::MapAccess<'de> for &'a mut Deserializer<'de> { } } -// activate when stable; too soon now -//#[cfg(debug_assertions)] #[inline] fn deserialize_str(input: &[u8]) -> Result<&str> { string::str_from_bytes(input) } - -//#[cfg(not(debug_assertions))] -#[cfg(disable)] -#[inline] -fn deserialize_str(input: &[u8]) -> Result<&str> { - // SAFETY: Strings were written by the serializer to the database. Assuming - // no database corruption, the string will be valid. Database corruption is - // detected via rocksdb checksums. - unsafe { std::str::from_utf8_unchecked(input) } -} diff --git a/src/database/util.rs b/src/database/util.rs index bcefa2867..a04f0b0af 100644 --- a/src/database/util.rs +++ b/src/database/util.rs @@ -1,28 +1,12 @@ use conduwuit::Result; use rocksdb::{Direction, ErrorKind, IteratorMode}; -//#[cfg(debug_assertions)] macro_rules! unhandled { ($msg:literal) => { unimplemented!($msg) }; } -// activate when stable; we're not ready for this yet -#[cfg(disable)] // #[cfg(not(debug_assertions))] -macro_rules! unhandled { - ($msg:literal) => { - // SAFETY: Eliminates branches for serializing and deserializing types never - // encountered in the codebase. This can promote optimization and reduce - // codegen. The developer must verify for every invoking callsite that the - // unhandled type is in no way involved and could not possibly be - // encountered. - unsafe { - std::hint::unreachable_unchecked(); - } - }; -} - pub(crate) use unhandled; #[inline]