Skip to content

Commit 60d55b7

Browse files
committed
core: simplify CStr::default()
Just use a `CStr`-literal...
1 parent 10c3ea0 commit 60d55b7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

core/src/ffi/c_str.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ impl fmt::Debug for CStr {
179179
impl Default for &CStr {
180180
#[inline]
181181
fn default() -> Self {
182-
const SLICE: &[c_char] = &[0];
183-
// SAFETY: `SLICE` is indeed pointing to a valid nul-terminated string.
184-
unsafe { CStr::from_ptr(SLICE.as_ptr()) }
182+
c""
185183
}
186184
}
187185

0 commit comments

Comments
 (0)