Skip to content

Commit

Permalink
Enable lint: ignored_unit_patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdrozd committed Apr 25, 2024
1 parent a191d01 commit 989257c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/impl_/extract_argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
type Holder = ();

#[inline]
fn extract(obj: &'a Bound<'py, PyAny>, _: &'a mut ()) -> PyResult<Self> {
fn extract(obj: &'a Bound<'py, PyAny>, (): &'a mut ()) -> PyResult<Self> {
obj.extract()
}
}
Expand All @@ -50,7 +50,7 @@ impl<'a, 'py, T: 'py + PyTypeCheck> PyFunctionArgument<'a, 'py> for Option<&'a B
type Holder = ();

#[inline]
fn extract(obj: &'a Bound<'py, PyAny>, _: &'a mut ()) -> PyResult<Self> {
fn extract(obj: &'a Bound<'py, PyAny>, (): &'a mut ()) -> PyResult<Self> {
if obj.is_none() {
Ok(None)
} else {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
)
)))]
#![deny(
clippy::ignored_unit_patterns,
clippy::implicit_clone,
clippy::inefficient_to_string,
clippy::map_unwrap_or,
Expand Down
8 changes: 4 additions & 4 deletions src/pycell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ impl<T: PyClass> PyCell<T> {
self.0
.borrow_checker()
.try_borrow_unguarded()
.map(|_: ()| &*self.0.get_ptr())
.map(|()| &*self.0.get_ptr())
}

/// Provide an immutable borrow of the value `T` without acquiring the GIL.
Expand Down Expand Up @@ -662,15 +662,15 @@ impl<'py, T: PyClass> PyRef<'py, T> {
cell.ensure_threadsafe();
cell.borrow_checker()
.try_borrow()
.map(|_| Self { inner: obj.clone() })
.map(|()| Self { inner: obj.clone() })
}

pub(crate) fn try_borrow_threadsafe(obj: &Bound<'py, T>) -> Result<Self, PyBorrowError> {
let cell = obj.get_class_object();
cell.check_threadsafe()?;
cell.borrow_checker()
.try_borrow()
.map(|_| Self { inner: obj.clone() })
.map(|()| Self { inner: obj.clone() })
}
}

Expand Down Expand Up @@ -859,7 +859,7 @@ impl<'py, T: PyClass<Frozen = False>> PyRefMut<'py, T> {
cell.ensure_threadsafe();
cell.borrow_checker()
.try_borrow_mut()
.map(|_| Self { inner: obj.clone() })
.map(|()| Self { inner: obj.clone() })
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/types/bytearray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl PyByteArray {
std::ptr::write_bytes(buffer, 0u8, len);
// (Further) Initialise the bytearray in init
// If init returns an Err, pypybytearray will automatically deallocate the buffer
init(std::slice::from_raw_parts_mut(buffer, len)).map(|_| pybytearray)
init(std::slice::from_raw_parts_mut(buffer, len)).map(|()| pybytearray)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/types/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl PyBytes {
std::ptr::write_bytes(buffer, 0u8, len);
// (Further) Initialise the bytestring in init
// If init returns an Err, pypybytearray will automatically deallocate the buffer
init(std::slice::from_raw_parts_mut(buffer, len)).map(|_| pybytes)
init(std::slice::from_raw_parts_mut(buffer, len)).map(|()| pybytes)
}
}

Expand Down

0 comments on commit 989257c

Please sign in to comment.