mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-10-02 14:54:30 +00:00
Refactor terminator pop
This commit is contained in:
parent
424f5ab39c
commit
fb8525bad4
@ -223,13 +223,9 @@ impl<const N: usize> CString<N> {
|
||||
/// # Safety: caller must ensure to re-add the terminator after this function is called
|
||||
#[inline]
|
||||
unsafe fn pop_terminator(&mut self) {
|
||||
if cfg!(debug_assertions) {
|
||||
let popped = self.vec.pop();
|
||||
debug_assert_eq!(self.vec.last(), Some(&0));
|
||||
|
||||
assert_eq!(popped, Some(0));
|
||||
} else {
|
||||
unsafe { self.vec.pop_unchecked() };
|
||||
}
|
||||
unsafe { self.vec.pop_unchecked() };
|
||||
}
|
||||
|
||||
/// Converts a [`CString`] to a string slice without checking
|
||||
|
Loading…
x
Reference in New Issue
Block a user