Fix some clippy lints
This commit is contained in:
parent
670b41c898
commit
faa21f48c7
|
@ -47,10 +47,10 @@ pub fn build_py_proto(ast: &mut syn::ItemImpl) -> syn::Result<TokenStream> {
|
|||
|
||||
Ok(tokens)
|
||||
} else {
|
||||
return Err(syn::Error::new_spanned(
|
||||
Err(syn::Error::new_spanned(
|
||||
ast,
|
||||
"#[pyproto] can only be used with protocol trait implementations",
|
||||
));
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ where
|
|||
// Behave like python's __getattr__ (as opposed to __getattribute__) and check
|
||||
// for existing fields and methods first
|
||||
let existing = ffi::PyObject_GenericGetAttr(slf, arg);
|
||||
if existing == std::ptr::null_mut() {
|
||||
if existing.is_null() {
|
||||
// PyObject_HasAttr also tries to get an object and clears the error if it fails
|
||||
ffi::PyErr_Clear();
|
||||
} else {
|
||||
|
@ -233,7 +233,7 @@ where
|
|||
|
||||
let result = match arg.extract() {
|
||||
Ok(arg) => slf.__getattr__(arg).into(),
|
||||
Err(e) => Err(e.into()),
|
||||
Err(e) => Err(e),
|
||||
};
|
||||
crate::callback::cb_convert(PyObjectCallbackConverter, py, result)
|
||||
}
|
||||
|
|
|
@ -21,10 +21,7 @@ pyobject_native_type!(PyTuple, ffi::PyTuple_Type, ffi::PyTuple_Check);
|
|||
|
||||
impl PyTuple {
|
||||
/// Construct a new tuple with the given elements.
|
||||
pub fn new<'p, T, U>(
|
||||
py: Python<'p>,
|
||||
elements: impl IntoIterator<Item = T, IntoIter = U>,
|
||||
) -> &'p PyTuple
|
||||
pub fn new<T, U>(py: Python, elements: impl IntoIterator<Item = T, IntoIter = U>) -> &PyTuple
|
||||
where
|
||||
T: ToPyObject,
|
||||
U: ExactSizeIterator<Item = T>,
|
||||
|
@ -41,7 +38,7 @@ impl PyTuple {
|
|||
}
|
||||
|
||||
/// Retrieves the empty tuple.
|
||||
pub fn empty<'p>(py: Python<'p>) -> &'p PyTuple {
|
||||
pub fn empty(py: Python) -> &PyTuple {
|
||||
unsafe { py.from_owned_ptr(ffi::PyTuple_New(0)) }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue