diff --git a/src/lib.rs b/src/lib.rs index a305996..e0a1011 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -92,9 +92,7 @@ use core::mem::MaybeUninit; /// /// It is also faster because it doesn't grow in size. When a [`Map`] is created, /// its size is fixed on stack. If an attempt is made to insert too many keys -/// into it, it simply panics. Moreover, in the "release" mode it doesn't panic, -/// but its behaviour is undefined. In the "release" mode all boundary checks -/// are disabled, for the sake of higher performance. +/// into it, it simply panics. pub struct Map { /// The next available pair in the array. len: usize, diff --git a/src/map.rs b/src/map.rs index 31976e1..ca2dd3b 100644 --- a/src/map.rs +++ b/src/map.rs @@ -151,10 +151,7 @@ impl Map { /// /// # Panics /// - /// It may panic if there are too many pairs in the map already. Pay attention, - /// it panics only in the "debug" mode. In the "release" mode, you are going to get - /// undefined behavior. This is done for the sake of performance, in order to - /// avoid a repetitive check for the boundary condition on every `insert()`. + /// It may panic if there are too many pairs in the map already. #[inline] pub fn insert(&mut self, k: K, v: V) -> Option { let (_, existing_value) = self.insert_i(k, v); @@ -168,8 +165,7 @@ impl Map { let mut existing_value = None; loop { if i == self.len { - #[cfg(feature = "std")] - debug_assert!(target < N, "No more keys available in the map"); + assert!(target < N, "No more keys available in the map"); break; } let p = self.item_ref(i); diff --git a/src/set/functions.rs b/src/set/functions.rs index c919673..bd4b75a 100644 --- a/src/set/functions.rs +++ b/src/set/functions.rs @@ -80,10 +80,7 @@ impl Set { /// /// # Panics /// - /// It may panic if there are too many pairs in the set already. Pay attention, - /// it panics only in the "debug" mode. In the "release" mode, you are going to get - /// undefined behavior. This is done for the sake of performance, in order to - /// avoid a repetitive check for the boundary condition on every `insert()`. + /// It may panic if there are too many pairs in the set already. #[inline] pub fn insert(&mut self, k: T) -> bool { self.map.insert(k, ()).is_none() diff --git a/src/set/mod.rs b/src/set/mod.rs index 03749e3..36452ce 100644 --- a/src/set/mod.rs +++ b/src/set/mod.rs @@ -34,9 +34,7 @@ use crate::Map; /// /// It is also faster because it doesn't grow in size. When a [`Set`] is created, /// its size is fixed on stack. If an attempt is made to insert too many keys -/// into it, it simply panics. Moreover, in the "release" mode it doesn't panic, -/// but its behaviour is undefined. In the "release" mode all boundary checks -/// are disabled, for the sake of higher performance. +/// into it, it simply panics. #[repr(transparent)] pub struct Set { map: Map,