Merge pull request #2504 from davidhewitt/fix-beta-clippy

clippy: fix some warnings from beta toolchain
This commit is contained in:
David Hewitt 2022-07-13 08:39:16 +01:00 committed by GitHub
commit adfc83681d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 28 additions and 42 deletions

View File

@ -181,7 +181,7 @@ jobs:
run: |
set -x
cargo update -p indexmap --precise 1.6.2
cargo update -p hashbrown:0.12.1 --precise 0.9.1
cargo update -p hashbrown:0.12.2 --precise 0.9.1
PROJECTS=("." "examples/decorator" "examples/maturin-starter" "examples/setuptools-rust-starter" "examples/word-count")
for PROJ in ${PROJECTS[@]}; do
cargo update --manifest-path "$PROJ/Cargo.toml" -p parking_lot --precise 0.11.0

View File

@ -69,7 +69,7 @@ pub fn target_triple_from_env() -> Triple {
///
/// When the `PYO3_NO_PYTHON` variable is set, or during cross compile situations, then alternative
/// strategies are used to populate this type.
#[cfg_attr(test, derive(Debug, PartialEq))]
#[cfg_attr(test, derive(Debug, PartialEq, Eq))]
pub struct InterpreterConfig {
/// The Python implementation flavor.
///
@ -634,7 +634,7 @@ impl FromStr for PythonVersion {
}
}
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PythonImplementation {
CPython,
PyPy,
@ -742,7 +742,7 @@ fn require_libdir_for_target(target: &Triple) -> bool {
///
/// Usually this is collected from the environment (i.e. `PYO3_CROSS_*` and `CARGO_CFG_TARGET_*`)
/// when a cross-compilation configuration is detected.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct CrossCompileConfig {
/// The directory containing the Python library to link against.
pub lib_dir: Option<PathBuf>,
@ -1036,7 +1036,7 @@ impl FromStr for BuildFlag {
/// is the equivalent of `#ifdef {varname}` in C.
///
/// see Misc/SpecialBuilds.txt in the python source for what these mean.
#[cfg_attr(test, derive(Debug, PartialEq))]
#[cfg_attr(test, derive(Debug, PartialEq, Eq))]
#[derive(Clone, Default)]
pub struct BuildFlags(pub HashSet<BuildFlag>);

View File

@ -40,7 +40,7 @@ pub struct KeywordAttribute<K, V> {
/// A helper type which parses the inner type via a literal string
/// e.g. LitStrValue<Path> -> parses "some::path" in quotes.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct LitStrValue<T>(pub T);
impl<T: Parse> Parse for LitStrValue<T> {
@ -57,7 +57,7 @@ impl<T: ToTokens> ToTokens for LitStrValue<T> {
}
/// A helper type which parses a name via a literal string
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct NameLitStr(pub Ident);
impl Parse for NameLitStr {

View File

@ -21,7 +21,7 @@ use syn::{
token::Comma,
};
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Argument {
PosOnlyArgsSeparator,
VarArgsSeparator,

View File

@ -964,7 +964,7 @@ impl<'a, T: PyClass<Frozen = False>> std::convert::TryFrom<&'a PyCell<T>>
impl<T: PyClass<Frozen = False> + fmt::Debug> fmt::Debug for PyRefMut<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&*(self.deref()), f)
fmt::Debug::fmt(self.deref(), f)
}
}

View File

@ -16,7 +16,7 @@ use std::str;
/// Python internally stores strings in various representations. This enumeration
/// represents those variations.
#[cfg(all(not(Py_LIMITED_API), target_endian = "little"))]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PyStringData<'a> {
/// UCS1 representation.
Ucs1(&'a [u8]),

View File

@ -1,17 +1,17 @@
error[E0277]: the trait bound `pyo3::Python<'_>: Ungil` is not satisfied in `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:38]`
error[E0277]: the trait bound `pyo3::Python<'_>: Ungil` is not satisfied in `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:24]`
--> tests/ui/not_send_auto_trait.rs:4:8
|
4 | py.allow_threads(|| { drop(py); });
| ^^^^^^^^^^^^^ ---------------- within this `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:38]`
| ^^^^^^^^^^^^^ -- within this `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:24]`
| |
| within `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:38]`, the trait `Ungil` is not implemented for `pyo3::Python<'_>`
| within `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:24]`, the trait `Ungil` is not implemented for `pyo3::Python<'_>`
|
= note: required because it appears within the type `&pyo3::Python<'_>`
note: required because it's used within this closure
--> tests/ui/not_send_auto_trait.rs:4:22
|
4 | py.allow_threads(|| { drop(py); });
| ^^^^^^^^^^^^^^^^
| ^^
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
--> src/marker.rs
|

View File

@ -1,13 +1,10 @@
error[E0277]: the trait bound `PyAny: Ungil` is not satisfied in `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 10:10]`
error[E0277]: the trait bound `PyAny: Ungil` is not satisfied in `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 8:28]`
--> tests/ui/not_send_auto_trait2.rs:8:12
|
8 | py.allow_threads(|| {
| ____________^^^^^^^^^^^^^_-
| | |
| | within `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 10:10]`, the trait `Ungil` is not implemented for `PyAny`
9 | | println!("{:?}", string);
10 | | });
| |_________- within this `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 10:10]`
8 | py.allow_threads(|| {
| ^^^^^^^^^^^^^ -- within this `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 8:28]`
| |
| within `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 8:28]`, the trait `Ungil` is not implemented for `PyAny`
|
= note: required because it appears within the type `PyString`
= note: required because it appears within the type `&PyString`
@ -15,11 +12,8 @@ error[E0277]: the trait bound `PyAny: Ungil` is not satisfied in `[closure@$DIR/
note: required because it's used within this closure
--> tests/ui/not_send_auto_trait2.rs:8:26
|
8 | py.allow_threads(|| {
| __________________________^
9 | | println!("{:?}", string);
10 | | });
| |_________^
8 | py.allow_threads(|| {
| ^^
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
--> src/marker.rs
|

View File

@ -1,14 +1,10 @@
error[E0277]: the trait bound `PyAny: Ungil` is not satisfied in `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 14:10]`
error[E0277]: the trait bound `PyAny: Ungil` is not satisfied in `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 11:28]`
--> tests/ui/send_wrapper.rs:11:12
|
11 | py.allow_threads(|| {
| ____________^^^^^^^^^^^^^_-
| | |
| | within `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 14:10]`, the trait `Ungil` is not implemented for `PyAny`
12 | | let smuggled: &PyString = *wrapped;
13 | | println!("{:?}", smuggled);
14 | | });
| |_________- within this `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 14:10]`
11 | py.allow_threads(|| {
| ^^^^^^^^^^^^^ -- within this `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 11:28]`
| |
| within `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 11:28]`, the trait `Ungil` is not implemented for `PyAny`
|
= note: required because it appears within the type `PyString`
= note: required because it appears within the type `&PyString`
@ -18,12 +14,8 @@ error[E0277]: the trait bound `PyAny: Ungil` is not satisfied in `[closure@$DIR/
note: required because it's used within this closure
--> tests/ui/send_wrapper.rs:11:26
|
11 | py.allow_threads(|| {
| __________________________^
12 | | let smuggled: &PyString = *wrapped;
13 | | println!("{:?}", smuggled);
14 | | });
| |_________^
11 | py.allow_threads(|| {
| ^^
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
--> src/marker.rs
|