-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable some Clippy lints #4120
Enable some Clippy lints #4120
Changes from all commits
d32ef64
7d7c4a7
96026dd
80782ca
cab28df
9d8cc59
ee0a9ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)) | ||
Comment on lines
-694
to
-701
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This lint looks like a false positive to me. Something we could consider changing here would be to remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had tried that initially, but explicit return seems to be required:
|
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this one - maybe
to_owned
is more readable?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an artefact from refactoring the initial implementation and
clone
seems appropriate, i.e. we have aPyBytes
and just want another reference to it, not change from a borrowed to an owned type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lint description says that there is no difference, and
to_owned
is misleading because there is no change in ownership.