Skip to content

Commit 01b44ed

Browse files
committed
src/impl_: use mem::zeroed over ZEROED_SLOT
1 parent 8702979 commit 01b44ed

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/impl_/pymodule.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ impl<const N: usize> PyModuleSlotsBuilder<N> {
193193
#[allow(clippy::new_without_default)]
194194
pub const fn new() -> Self {
195195
Self {
196-
// Because the array is c-style, the empty elements should be zeroed.
197-
// `std::mem::zeroed()` requires msrv 1.75 for const
198-
values: [ZEROED_SLOT; N],
196+
values: [unsafe { std::mem::zeroed() }; N],
199197
len: 0,
200198
}
201199
}
@@ -258,11 +256,6 @@ pub struct PyModuleSlots<const N: usize>(UnsafeCell<[ffi::PyModuleDef_Slot; N]>)
258256
// which only uses them to build the `ffi::ModuleDef`.
259257
unsafe impl<const N: usize> Sync for PyModuleSlots<N> {}
260258

261-
const ZEROED_SLOT: ffi::PyModuleDef_Slot = ffi::PyModuleDef_Slot {
262-
slot: 0,
263-
value: std::ptr::null_mut(),
264-
};
265-
266259
/// Trait to add an element (class, function...) to a module.
267260
///
268261
/// Currently only implemented for classes.

0 commit comments

Comments
 (0)