Merge pull request #2548 from messense/clippy-1.63
Fix new clippy warnings in Rust 1.63.0
This commit is contained in:
commit
020e583f7b
|
@ -52,6 +52,7 @@ fn _test_compile_errors() {
|
|||
tests_rust_1_58(&t);
|
||||
tests_rust_1_60(&t);
|
||||
tests_rust_1_62(&t);
|
||||
tests_rust_1_63(&t);
|
||||
|
||||
#[rustversion::since(1.49)]
|
||||
fn tests_rust_1_49(t: &trybuild::TestCases) {
|
||||
|
@ -85,9 +86,6 @@ fn _test_compile_errors() {
|
|||
fn tests_rust_1_58(t: &trybuild::TestCases) {
|
||||
t.compile_fail("tests/ui/invalid_pyfunctions.rs");
|
||||
t.compile_fail("tests/ui/invalid_pymethods.rs");
|
||||
t.compile_fail("tests/ui/not_send.rs");
|
||||
t.compile_fail("tests/ui/not_send2.rs");
|
||||
t.compile_fail("tests/ui/not_send3.rs");
|
||||
#[cfg(Py_LIMITED_API)]
|
||||
t.compile_fail("tests/ui/abi3_nativetype_inheritance.rs");
|
||||
}
|
||||
|
@ -107,12 +105,22 @@ fn _test_compile_errors() {
|
|||
#[rustversion::since(1.62)]
|
||||
fn tests_rust_1_62(t: &trybuild::TestCases) {
|
||||
t.compile_fail("tests/ui/invalid_pymethod_receiver.rs");
|
||||
t.compile_fail("tests/ui/invalid_result_conversion.rs");
|
||||
t.compile_fail("tests/ui/missing_intopy.rs");
|
||||
}
|
||||
|
||||
#[rustversion::before(1.62)]
|
||||
fn tests_rust_1_62(_t: &trybuild::TestCases) {}
|
||||
|
||||
#[rustversion::since(1.63)]
|
||||
fn tests_rust_1_63(t: &trybuild::TestCases) {
|
||||
t.compile_fail("tests/ui/invalid_result_conversion.rs");
|
||||
t.compile_fail("tests/ui/not_send.rs");
|
||||
t.compile_fail("tests/ui/not_send2.rs");
|
||||
t.compile_fail("tests/ui/not_send3.rs");
|
||||
}
|
||||
|
||||
#[rustversion::before(1.63)]
|
||||
fn tests_rust_1_63(_t: &trybuild::TestCases) {}
|
||||
}
|
||||
|
||||
#[cfg(feature = "nightly")]
|
||||
|
|
|
@ -6,7 +6,7 @@ use pyo3::{py_run, wrap_pyfunction};
|
|||
mod common;
|
||||
|
||||
#[pyclass]
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub enum MyEnum {
|
||||
Variant,
|
||||
OtherVariant,
|
||||
|
@ -163,7 +163,7 @@ fn test_repr_parse() {
|
|||
}
|
||||
|
||||
#[pyclass(name = "MyEnum")]
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub enum RenameEnum {
|
||||
Variant,
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ fn test_rename_enum_repr_correct() {
|
|||
}
|
||||
|
||||
#[pyclass]
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub enum RenameVariantEnum {
|
||||
#[pyo3(name = "VARIANT")]
|
||||
Variant,
|
||||
|
|
|
@ -532,7 +532,7 @@ fn test_from_py_with_tuple_struct_error() {
|
|||
});
|
||||
}
|
||||
|
||||
#[derive(Debug, FromPyObject, PartialEq)]
|
||||
#[derive(Debug, FromPyObject, PartialEq, Eq)]
|
||||
pub enum ZapEnum {
|
||||
Zip(#[pyo3(from_py_with = "PyAny::len")] usize),
|
||||
Zap(String, #[pyo3(from_py_with = "PyAny::len")] usize),
|
||||
|
@ -552,7 +552,7 @@ fn test_from_py_with_enum() {
|
|||
});
|
||||
}
|
||||
|
||||
#[derive(Debug, FromPyObject, PartialEq)]
|
||||
#[derive(Debug, FromPyObject, PartialEq, Eq)]
|
||||
#[pyo3(transparent)]
|
||||
pub struct TransparentFromPyWith {
|
||||
#[pyo3(from_py_with = "PyAny::len")]
|
||||
|
|
|
@ -176,7 +176,7 @@ fn inheritance_with_new_methods_with_drop() {
|
|||
let typeobj = py.get_type::<SubClassWithDrop>();
|
||||
let inst = typeobj.call((), None).unwrap();
|
||||
|
||||
let obj: &PyCell<SubClassWithDrop> = PyTryInto::try_into(&*inst).unwrap();
|
||||
let obj: &PyCell<SubClassWithDrop> = PyTryInto::try_into(inst).unwrap();
|
||||
let mut obj_ref_mut = obj.borrow_mut();
|
||||
obj_ref_mut.data = Some(Arc::clone(&drop_called1));
|
||||
let base: &mut BaseClassWithDrop = obj_ref_mut.as_mut();
|
||||
|
|
|
@ -195,7 +195,7 @@ fn inheritance_with_new_methods_with_drop() {
|
|||
let typeobj = py.get_type::<SubClassWithDrop>();
|
||||
let inst = typeobj.call((), None).unwrap();
|
||||
|
||||
let obj: &PyCell<SubClassWithDrop> = PyTryInto::try_into(&*inst).unwrap();
|
||||
let obj: &PyCell<SubClassWithDrop> = PyTryInto::try_into(inst).unwrap();
|
||||
let mut obj_ref_mut = obj.borrow_mut();
|
||||
obj_ref_mut.data = Some(Arc::clone(&drop_called1));
|
||||
let base: &mut BaseClassWithDrop = obj_ref_mut.as_mut();
|
||||
|
|
|
@ -4,7 +4,16 @@ error[E0599]: no method named `assert_into_py_result` found for enum `Result` in
|
|||
21 | #[pyfunction]
|
||||
| ^^^^^^^^^^^^^ method not found in `Result<(), MyError>`
|
||||
|
|
||||
note: the method `assert_into_py_result` exists on the type `()`
|
||||
--> src/impl_/ghost.rs
|
||||
|
|
||||
| fn assert_into_py_result(&mut self) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the attribute macro `pyfunction` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: use the `?` operator to extract the `()` value, propagating a `Result::Err` value to the caller
|
||||
|
|
||||
21 | #[pyfunction]?
|
||||
| +
|
||||
|
||||
error[E0277]: the trait bound `Result<(), MyError>: IntoPyCallbackOutput<_>` is not satisfied
|
||||
--> tests/ui/invalid_result_conversion.rs:21:1
|
||||
|
|
|
@ -11,7 +11,11 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
|
|||
= note: required because it appears within the type `PhantomData<(&GILGuard, impl_::not_send::NotSend)>`
|
||||
= note: required because it appears within the type `pyo3::Python<'_>`
|
||||
= note: required because of the requirements on the impl of `Send` for `&pyo3::Python<'_>`
|
||||
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]`
|
||||
note: required because it's used within this closure
|
||||
--> tests/ui/not_send.rs:4:22
|
||||
|
|
||||
4 | py.allow_threads(|| { drop(py); });
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]`
|
||||
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
|
||||
--> src/marker.rs
|
||||
|
|
|
@ -9,7 +9,14 @@ error[E0277]: `UnsafeCell<PyObject>` cannot be shared between threads safely
|
|||
= note: required because it appears within the type `PyString`
|
||||
= note: required because it appears within the type `&PyString`
|
||||
= note: required because of the requirements on the impl of `Send` for `&&PyString`
|
||||
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send2.rs:8:26: 10:10]`
|
||||
note: required because it's used within this closure
|
||||
--> tests/ui/not_send2.rs:8:26
|
||||
|
|
||||
8 | py.allow_threads(|| {
|
||||
| __________________________^
|
||||
9 | | println!("{:?}", string);
|
||||
10 | | });
|
||||
| |_________^
|
||||
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send2.rs:8:26: 10:10]`
|
||||
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
|
||||
--> src/marker.rs
|
||||
|
|
|
@ -6,7 +6,14 @@ error[E0277]: `Rc<i32>` cannot be shared between threads safely
|
|||
|
|
||||
= help: the trait `Sync` is not implemented for `Rc<i32>`
|
||||
= note: required because of the requirements on the impl of `Send` for `&Rc<i32>`
|
||||
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send3.rs:8:26: 10:10]`
|
||||
note: required because it's used within this closure
|
||||
--> tests/ui/not_send3.rs:8:26
|
||||
|
|
||||
8 | py.allow_threads(|| {
|
||||
| __________________________^
|
||||
9 | | println!("{:?}", rc);
|
||||
10 | | });
|
||||
| |_________^
|
||||
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send3.rs:8:26: 10:10]`
|
||||
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
|
||||
--> src/marker.rs
|
||||
|
|
Loading…
Reference in New Issue