Skip to content

Commit

Permalink
Enable lint: redundant_else
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdrozd committed Apr 25, 2024
1 parent 989257c commit e742110
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
clippy::inefficient_to_string,
clippy::map_unwrap_or,
clippy::missing_const_for_fn,
clippy::redundant_else,
clippy::semicolon_if_nothing_returned,
clippy::type_repetition_in_bounds
)]
Expand Down
6 changes: 3 additions & 3 deletions src/types/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,14 +691,14 @@ fn type_output() -> TypeInfo {
fn extract_bound(obj: &Bound<'py, PyAny>) -> PyResult<Self>
{
let t = obj.downcast::<PyTuple>()?;
if t.len() == $length {
if t.len() != $length {
Err(wrong_tuple_length(t, $length))
} else {
#[cfg(any(Py_LIMITED_API, PyPy, GraalPy))]
return Ok(($(t.get_borrowed_item($n)?.extract::<$T>()?,)+));

#[cfg(not(any(Py_LIMITED_API, PyPy, GraalPy)))]
unsafe {return Ok(($(t.get_borrowed_item_unchecked($n).extract::<$T>()?,)+));}
} else {
Err(wrong_tuple_length(t, $length))
}
}

Expand Down

0 comments on commit e742110

Please sign in to comment.