handle clippy `new_without_default` warnings (#3971)
* handle clippy `new_without_default` warnings * add newsfragment
This commit is contained in:
parent
02e188e4b4
commit
caf80eca66
|
@ -0,0 +1 @@
|
||||||
|
Implement `Default` for `GILOnceCell`.
|
|
@ -46,6 +46,7 @@ mod bufferinfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Py_buffer {
|
impl Py_buffer {
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Py_buffer {
|
Py_buffer {
|
||||||
buf: ptr::null_mut(),
|
buf: ptr::null_mut(),
|
||||||
|
|
|
@ -27,6 +27,7 @@ pub struct Py_buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Py_buffer {
|
impl Py_buffer {
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Py_buffer {
|
Py_buffer {
|
||||||
buf: ptr::null_mut(),
|
buf: ptr::null_mut(),
|
||||||
|
|
|
@ -32,6 +32,7 @@ struct LazyTypeObjectInner {
|
||||||
|
|
||||||
impl<T> LazyTypeObject<T> {
|
impl<T> LazyTypeObject<T> {
|
||||||
/// Creates an uninitialized `LazyTypeObject`.
|
/// Creates an uninitialized `LazyTypeObject`.
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
LazyTypeObject(
|
LazyTypeObject(
|
||||||
LazyTypeObjectInner {
|
LazyTypeObjectInner {
|
||||||
|
|
|
@ -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));
|
/// # Python::with_gil(|py| assert_eq!(get_shared_list(py).len(), 0));
|
||||||
/// ```
|
/// ```
|
||||||
|
#[derive(Default)]
|
||||||
pub struct GILOnceCell<T>(UnsafeCell<Option<T>>);
|
pub struct GILOnceCell<T>(UnsafeCell<Option<T>>);
|
||||||
|
|
||||||
// T: Send is needed for Sync because the thread which drops the GILOnceCell can be different
|
// T: Send is needed for Sync because the thread which drops the GILOnceCell can be different
|
||||||
|
|
Loading…
Reference in New Issue