diff --git a/.cargo/config b/.cargo/config deleted file mode 100644 index 5b19f2fa..00000000 --- a/.cargo/config +++ /dev/null @@ -1,20 +0,0 @@ -[target.'cfg(feature = "cargo-clippy")'] -rustflags = [ - # Lints to enforce in CI - "-Dclippy::checked_conversions", - "-Dclippy::dbg_macro", - "-Dclippy::explicit_into_iter_loop", - "-Dclippy::explicit_iter_loop", - "-Dclippy::filter_map_next", - "-Dclippy::flat_map_option", - "-Dclippy::let_unit_value", - "-Dclippy::manual_assert", - "-Dclippy::manual_ok_or", - "-Dclippy::todo", - "-Dclippy::unnecessary_wraps", - "-Dclippy::useless_transmute", - "-Dclippy::used_underscore_binding", - "-Delided_lifetimes_in_paths", - "-Dunused_lifetimes", - "-Drust_2021_prelude_collisions" -] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 444f20b3..776b6c4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: run: echo "TRYBUILD=overwrite" >> "$GITHUB_ENV" - name: Build docs - run: cargo doc --no-deps --no-default-features --features "full ${{ inputs.extra-features }}" + run: nox -s docs - name: Build (no features) run: cargo build --lib --tests --no-default-features diff --git a/Cargo.toml b/Cargo.toml index 8b4584a8..021ed963 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,3 +127,32 @@ members = [ no-default-features = true features = ["macros", "num-bigint", "num-complex", "hashbrown", "serde", "multiple-pymethods", "indexmap", "eyre", "chrono", "rust_decimal"] rustdoc-args = ["--cfg", "docsrs"] + +[workspace.lints.clippy] +checked_conversions = "warn" +dbg_macro = "warn" +explicit_into_iter_loop = "warn" +explicit_iter_loop = "warn" +filter_map_next = "warn" +flat_map_option = "warn" +let_unit_value = "warn" +manual_assert = "warn" +manual_ok_or = "warn" +todo = "warn" +unnecessary_wraps = "warn" +useless_transmute = "warn" +used_underscore_binding = "warn" + +[workspace.lints.rust] +elided_lifetimes_in_paths = "warn" +invalid_doc_attributes = "warn" +rust_2018_idioms = "warn" +rust_2021_prelude_collisions = "warn" +unused_lifetimes = "warn" + +[workspace.lints.rustdoc] +broken_intra_doc_links = "warn" +bare_urls = "warn" + +[lints] +workspace = true diff --git a/pyo3-ffi/Cargo.toml b/pyo3-ffi/Cargo.toml index 7397691e..a380e1a3 100644 --- a/pyo3-ffi/Cargo.toml +++ b/pyo3-ffi/Cargo.toml @@ -36,6 +36,8 @@ abi3-py311 = ["abi3", "pyo3-build-config/abi3-py311"] # Automatically generates `python3.dll` import libraries for Windows targets. generate-import-lib = ["pyo3-build-config/python3-dll-a"] - [build-dependencies] pyo3-build-config = { path = "../pyo3-build-config", version = "0.20.0", features = ["resolve-config"] } + +[lints] +workspace = true diff --git a/pyo3-macros-backend/Cargo.toml b/pyo3-macros-backend/Cargo.toml index de782f25..5e9520d3 100644 --- a/pyo3-macros-backend/Cargo.toml +++ b/pyo3-macros-backend/Cargo.toml @@ -25,3 +25,6 @@ features = ["derive", "parsing", "printing", "clone-impls", "full", "extra-trait [features] abi3 = [] + +[lints] +workspace = true diff --git a/pyo3-macros/Cargo.toml b/pyo3-macros/Cargo.toml index 7e936f0b..0e8f499f 100644 --- a/pyo3-macros/Cargo.toml +++ b/pyo3-macros/Cargo.toml @@ -23,3 +23,6 @@ proc-macro2 = { version = "1", default-features = false } quote = "1" syn = { version = "2", features = ["full", "extra-traits"] } pyo3-macros-backend = { path = "../pyo3-macros-backend", version = "=0.20.0" } + +[lints] +workspace = true diff --git a/pyo3-macros/src/lib.rs b/pyo3-macros/src/lib.rs index 37c7e6e9..d00ede89 100644 --- a/pyo3-macros/src/lib.rs +++ b/pyo3-macros/src/lib.rs @@ -2,8 +2,6 @@ //! must not contain any other public items. #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -extern crate proc_macro; - use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use pyo3_macros_backend::{ diff --git a/pytests/Cargo.toml b/pytests/Cargo.toml index 2b7e8ec8..255094a6 100644 --- a/pytests/Cargo.toml +++ b/pytests/Cargo.toml @@ -15,3 +15,6 @@ pyo3-build-config = { path = "../pyo3-build-config" } [lib] name = "pyo3_pytests" crate-type = ["cdylib"] + +[lints] +workspace = true diff --git a/src/lib.rs b/src/lib.rs index ad0bc3dc..3c422dd2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,15 +1,6 @@ #![warn(missing_docs)] #![cfg_attr(feature = "nightly", feature(auto_traits, negative_impls))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![cfg_attr( - docsrs, // rustdoc:: is not supported on msrv - deny( - invalid_doc_attributes, - rustdoc::broken_intra_doc_links, - rustdoc::bare_urls - ) -)] -#![warn(rust_2018_idioms, unused_lifetimes)] // Deny some lints in doctests. // Use `#[allow(...)]` locally to override. #![doc(test(attr(