handle clippy `new_without_default` warnings (#3971)

* handle clippy `new_without_default` warnings

* add newsfragment
This commit is contained in:
David Hewitt 2024-03-19 21:41:27 +00:00 committed by GitHub
parent 02e188e4b4
commit caf80eca66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 5 additions and 0 deletions

View File

@ -0,0 +1 @@
Implement `Default` for `GILOnceCell`.

View File

@ -46,6 +46,7 @@ mod bufferinfo {
}
impl Py_buffer {
#[allow(clippy::new_without_default)]
pub const fn new() -> Self {
Py_buffer {
buf: ptr::null_mut(),

View File

@ -27,6 +27,7 @@ pub struct Py_buffer {
}
impl Py_buffer {
#[allow(clippy::new_without_default)]
pub const fn new() -> Self {
Py_buffer {
buf: ptr::null_mut(),

View File

@ -32,6 +32,7 @@ struct LazyTypeObjectInner {
impl<T> LazyTypeObject<T> {
/// Creates an uninitialized `LazyTypeObject`.
#[allow(clippy::new_without_default)]
pub const fn new() -> Self {
LazyTypeObject(
LazyTypeObjectInner {

View File

@ -90,6 +90,7 @@ unsafe impl<T> Sync for GILProtected<T> where T: Send {}
/// }
/// # Python::with_gil(|py| assert_eq!(get_shared_list(py).len(), 0));
/// ```
#[derive(Default)]
pub struct GILOnceCell<T>(UnsafeCell<Option<T>>);
// T: Send is needed for Sync because the thread which drops the GILOnceCell can be different