core: simplify CStr::default()

Just use a `CStr`-literal...
This commit is contained in:
joboet 2025-09-24 00:50:36 +02:00
parent 975e6c8fec
commit aa537824c4
No known key found for this signature in database
GPG key ID: 704E0149B0194B3C

View file

@ -179,9 +179,7 @@ impl fmt::Debug for CStr {
impl Default for &CStr {
#[inline]
fn default() -> Self {
const SLICE: &[c_char] = &[0];
// SAFETY: `SLICE` is indeed pointing to a valid nul-terminated string.
unsafe { CStr::from_ptr(SLICE.as_ptr()) }
c""
}
}