From 23298629e78217ca5cd7fac77197043635392507 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 22 Feb 2024 22:46:16 +0000 Subject: [PATCH] ci: workaround more aggressive nightly rust lints --- .github/workflows/build.yml | 2 +- Cargo.toml | 3 +++ pyo3-build-config/src/impl_.rs | 2 -- src/conversions/chrono.rs | 1 - src/conversions/num_bigint.rs | 4 +--- src/conversions/std/num.rs | 1 - src/lib.rs | 8 +++++++- src/pyclass/create_type_object.rs | 1 - src/types/capsule.rs | 2 +- src/types/list.rs | 1 - src/types/tuple.rs | 1 - 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cec63ab10a0..bddb499ed2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ on: jobs: build: - continue-on-error: ${{ endsWith(inputs.python-version, '-dev') || contains(fromJSON('["3.7", "pypy3.7"]'), inputs.python-version) }} + continue-on-error: ${{ endsWith(inputs.python-version, '-dev') || contains(fromJSON('["3.7", "pypy3.7"]'), inputs.python-version) || inputs.rust == 'beta' || inputs.rust == 'nightly' }} runs-on: ${{ inputs.os }} steps: - uses: actions/checkout@v4 diff --git a/Cargo.toml b/Cargo.toml index 930a003bd8e..97d9dde6f93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -153,6 +153,9 @@ invalid_doc_attributes = "warn" rust_2018_idioms = "warn" rust_2021_prelude_collisions = "warn" unused_lifetimes = "warn" +# rust nightly got stricter about these since PyO3 0.20 was released +dead_code = "allow" +unused_imports = "allow" [workspace.lints.rustdoc] broken_intra_doc_links = "warn" diff --git a/pyo3-build-config/src/impl_.rs b/pyo3-build-config/src/impl_.rs index 19dbef53dd9..5e22a458b78 100644 --- a/pyo3-build-config/src/impl_.rs +++ b/pyo3-build-config/src/impl_.rs @@ -8,7 +8,6 @@ mod import_lib; use std::{ collections::{HashMap, HashSet}, - convert::AsRef, env, ffi::{OsStr, OsString}, fmt::Display, @@ -1792,7 +1791,6 @@ fn unescape(escaped: &str) -> Vec { #[cfg(test)] mod tests { - use std::iter::FromIterator; use target_lexicon::triple; use super::*; diff --git a/src/conversions/chrono.rs b/src/conversions/chrono.rs index e29348fc7f6..bf15a1265c4 100644 --- a/src/conversions/chrono.rs +++ b/src/conversions/chrono.rs @@ -51,7 +51,6 @@ use chrono::{ DateTime, Datelike, Duration, NaiveDate, NaiveDateTime, NaiveTime, Offset, TimeZone, Timelike, }; use pyo3_ffi::{PyDateTime_IMPORT, PyTimeZone_FromOffset}; -use std::convert::TryInto; impl ToPyObject for Duration { fn to_object(&self, py: Python<'_>) -> PyObject { diff --git a/src/conversions/num_bigint.rs b/src/conversions/num_bigint.rs index 5cc2157d446..49f9a42c33e 100644 --- a/src/conversions/num_bigint.rs +++ b/src/conversions/num_bigint.rs @@ -47,9 +47,7 @@ //! assert n + 1 == value //! ``` -use crate::{ - ffi, types::*, FromPyObject, IntoPy, Py, PyAny, PyObject, PyResult, Python, ToPyObject, -}; +use crate::{ffi, types::*, FromPyObject, IntoPy, Py, PyObject, PyResult, Python, ToPyObject}; use num_bigint::{BigInt, BigUint}; diff --git a/src/conversions/std/num.rs b/src/conversions/std/num.rs index 1f3bf673a48..1a4ef82cbe6 100644 --- a/src/conversions/std/num.rs +++ b/src/conversions/std/num.rs @@ -3,7 +3,6 @@ use crate::inspect::types::TypeInfo; use crate::{ exceptions, ffi, FromPyObject, IntoPy, PyAny, PyErr, PyObject, PyResult, Python, ToPyObject, }; -use std::convert::TryFrom; use std::num::{ NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize, NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize, diff --git a/src/lib.rs b/src/lib.rs index ecaaf648060..5748b7ea68d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,13 @@ rust_2021_prelude_collisions, warnings ), - allow(unused_variables, unused_assignments, unused_extern_crates) + allow( + unused_variables, + unused_assignments, + unused_extern_crates, + unused_imports, + dead_code, + ) )))] //! Rust bindings to the Python interpreter. diff --git a/src/pyclass/create_type_object.rs b/src/pyclass/create_type_object.rs index a7196f30288..65d16e59511 100644 --- a/src/pyclass/create_type_object.rs +++ b/src/pyclass/create_type_object.rs @@ -17,7 +17,6 @@ use crate::{ use std::{ borrow::Cow, collections::HashMap, - convert::TryInto, ffi::{CStr, CString}, os::raw::{c_char, c_int, c_ulong, c_void}, ptr, diff --git a/src/types/capsule.rs b/src/types/capsule.rs index f97320eb474..221c37d9e9e 100644 --- a/src/types/capsule.rs +++ b/src/types/capsule.rs @@ -1,6 +1,6 @@ use crate::Python; use crate::{ffi, PyAny}; -use crate::{pyobject_native_type_core, PyErr, PyResult}; +use crate::{PyErr, PyResult}; use std::ffi::{CStr, CString}; use std::os::raw::{c_char, c_int, c_void}; diff --git a/src/types/list.rs b/src/types/list.rs index 71261ba6baa..87b9fb9c171 100644 --- a/src/types/list.rs +++ b/src/types/list.rs @@ -1,4 +1,3 @@ -use std::convert::TryInto; use std::iter::FusedIterator; use crate::err::{self, PyResult}; diff --git a/src/types/tuple.rs b/src/types/tuple.rs index 0165061a7a1..548e0dab5e5 100644 --- a/src/types/tuple.rs +++ b/src/types/tuple.rs @@ -1,4 +1,3 @@ -use std::convert::TryInto; use std::iter::FusedIterator; use crate::ffi::{self, Py_ssize_t};