From 46942b9a140a9dfa000e9dee3ae8e52f9fa7e93a Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Thu, 8 Jun 2023 21:04:49 +0100 Subject: [PATCH] docs: remove workarounds for `#[doc = concat!(...)]` following msrv bump --- pyo3-ffi/src/lib.rs | 4 +--- src/conversion.rs | 2 +- src/conversions/anyhow.rs | 7 +------ src/conversions/chrono.rs | 7 +------ src/conversions/eyre.rs | 4 +--- src/conversions/hashbrown.rs | 7 +------ src/conversions/indexmap.rs | 7 +------ src/conversions/num_bigint.rs | 7 +------ src/conversions/num_complex.rs | 7 +------ src/conversions/rust_decimal.rs | 7 +------ src/conversions/serde.rs | 7 +------ src/lib.rs | 10 +++------- 12 files changed, 14 insertions(+), 62 deletions(-) diff --git a/pyo3-ffi/src/lib.rs b/pyo3-ffi/src/lib.rs index 091daee4..a3532390 100644 --- a/pyo3-ffi/src/lib.rs +++ b/pyo3-ffi/src/lib.rs @@ -75,9 +75,7 @@ //! crate-type = ["cdylib"] //! //! [dependencies.pyo3-ffi] -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("version = \"", env!("CARGO_PKG_VERSION"), "\"")))] -#![cfg_attr(not(docsrs), doc = "version = \"*\"")] +#![doc = concat!("version = \"", env!("CARGO_PKG_VERSION"), "\"")] //! features = ["extension-module"] //! ``` //! diff --git a/src/conversion.rs b/src/conversion.rs index a62ccc39..2e9268e2 100644 --- a/src/conversion.rs +++ b/src/conversion.rs @@ -212,7 +212,7 @@ pub trait ToPyObject { /// # } /// ``` /// Python code will see this as any of the `int`, `string` or `None` objects. -#[cfg_attr(docsrs, doc(alias = "IntoPyCallbackOutput"))] +#[doc(alias = "IntoPyCallbackOutput")] pub trait IntoPy: Sized { /// Performs the conversion. fn into_py(self, py: Python<'_>) -> T; diff --git a/src/conversions/anyhow.rs b/src/conversions/anyhow.rs index 614a0cc7..b362faf4 100644 --- a/src/conversions/anyhow.rs +++ b/src/conversions/anyhow.rs @@ -25,12 +25,7 @@ //! [dependencies] //! ## change * to the version you want to use, ideally the latest. //! anyhow = "*" -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"anyhow\"] }")))] -#![cfg_attr( - not(docsrs), - doc = "pyo3 = { version = \"*\", features = [\"anyhow\"] }" -)] +#![doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"anyhow\"] }")] //! ``` //! //! Note that you must use compatible versions of anyhow and PyO3. diff --git a/src/conversions/chrono.rs b/src/conversions/chrono.rs index 374fc161..dc74cae4 100644 --- a/src/conversions/chrono.rs +++ b/src/conversions/chrono.rs @@ -14,12 +14,7 @@ //! # change * to the latest versions //! pyo3 = { version = "*", features = ["chrono"] } //! chrono = "0.4" -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"chrono\"] }")))] -#![cfg_attr( - not(docsrs), - doc = "pyo3 = { version = \"*\", features = [\"chrono\"] }" -)] +#![doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"chrono\"] }")] //! ``` //! //! Note that you must use compatible versions of chrono and PyO3. diff --git a/src/conversions/eyre.rs b/src/conversions/eyre.rs index 6ea6143e..f881599e 100644 --- a/src/conversions/eyre.rs +++ b/src/conversions/eyre.rs @@ -24,9 +24,7 @@ //! [dependencies] //! ## change * to the version you want to use, ideally the latest. //! eyre = "*" -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"eyre\"] }")))] -#![cfg_attr(not(docsrs), doc = "pyo3 = { version = \"*\", features = [\"eyre\"] }")] +#![doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"eyre\"] }")] //! ``` //! //! Note that you must use compatible versions of eyre and PyO3. diff --git a/src/conversions/hashbrown.rs b/src/conversions/hashbrown.rs index c7a99ce0..f8cad574 100644 --- a/src/conversions/hashbrown.rs +++ b/src/conversions/hashbrown.rs @@ -11,12 +11,7 @@ //! [dependencies] //! # change * to the latest versions //! hashbrown = "*" -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"hashbrown\"] }")))] -#![cfg_attr( - not(docsrs), - doc = "pyo3 = { version = \"*\", features = [\"hashbrown\"] }" -)] +#![doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"hashbrown\"] }")] //! ``` //! //! Note that you must use compatible versions of hashbrown and PyO3. diff --git a/src/conversions/indexmap.rs b/src/conversions/indexmap.rs index b6ed7a2e..a83a5612 100644 --- a/src/conversions/indexmap.rs +++ b/src/conversions/indexmap.rs @@ -18,12 +18,7 @@ //! [dependencies] //! # change * to the latest versions //! indexmap = "*" -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"indexmap\"] }")))] -#![cfg_attr( - not(docsrs), - doc = "pyo3 = { version = \"*\", features = [\"indexmap\"] }" -)] +#![doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"indexmap\"] }")] //! ``` //! //! Note that you must use compatible versions of indexmap and PyO3. diff --git a/src/conversions/num_bigint.rs b/src/conversions/num_bigint.rs index 52ff2149..83c8e8a8 100644 --- a/src/conversions/num_bigint.rs +++ b/src/conversions/num_bigint.rs @@ -10,12 +10,7 @@ //! ```toml //! [dependencies] //! num-bigint = "*" -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"num-bigint\"] }")))] -#![cfg_attr( - not(docsrs), - doc = "pyo3 = { version = \"*\", features = [\"num-bigint\"] }" -)] +#![doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"num-bigint\"] }")] //! ``` //! //! Note that you must use compatible versions of num-bigint and PyO3. diff --git a/src/conversions/num_complex.rs b/src/conversions/num_complex.rs index df6b54b4..59e9b096 100644 --- a/src/conversions/num_complex.rs +++ b/src/conversions/num_complex.rs @@ -14,12 +14,7 @@ //! [dependencies] //! # change * to the latest versions //! num-complex = "*" -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"num-complex\"] }")))] -#![cfg_attr( - not(docsrs), - doc = "pyo3 = { version = \"*\", features = [\"num-complex\"] }" -)] +#![doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"num-complex\"] }")] //! ``` //! //! Note that you must use compatible versions of num-complex and PyO3. diff --git a/src/conversions/rust_decimal.rs b/src/conversions/rust_decimal.rs index 3e42a352..9ee9c0ef 100644 --- a/src/conversions/rust_decimal.rs +++ b/src/conversions/rust_decimal.rs @@ -9,13 +9,8 @@ //! //! ```toml //! [dependencies] +#![doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"rust_decimal\"] }")] //! rust_decimal = "1.0" -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"rust_decimal\"] }")))] -#![cfg_attr( - not(docsrs), - doc = "pyo3 = { version = ..., features = [\"rust_decimal\"] }" -)] //! ``` //! //! Note that you must use a compatible version of rust_decimal and PyO3. diff --git a/src/conversions/serde.rs b/src/conversions/serde.rs index b9dbed07..a769bd70 100644 --- a/src/conversions/serde.rs +++ b/src/conversions/serde.rs @@ -8,13 +8,8 @@ //! //! ```toml //! [dependencies] +#![doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"serde\"] }")] //! serde = "1.0" -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"serde\"] }")))] -#![cfg_attr( - not(docsrs), - doc = "pyo3 = { version = \"*\", features = [\"serde\"] }" -)] //! ``` use crate::{Py, PyAny, PyClass, Python}; diff --git a/src/lib.rs b/src/lib.rs index 1c3ab46e..0eb56b95 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -151,9 +151,7 @@ //! crate-type = ["cdylib"] //! //! [dependencies.pyo3] -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("version = \"", env!("CARGO_PKG_VERSION"), "\"")))] -#![cfg_attr(not(docsrs), doc = "version = \"*\"")] +#![doc = concat!("version = \"", env!("CARGO_PKG_VERSION"), "\"")] //! features = ["extension-module"] //! ``` //! @@ -214,9 +212,7 @@ //! Start a new project with `cargo new` and add `pyo3` to the `Cargo.toml` like this: //! ```toml //! [dependencies.pyo3] -// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 -#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("version = \"", env!("CARGO_PKG_VERSION"), "\"")))] -#![cfg_attr(not(docsrs), doc = "version = \"*\"")] +#![doc = concat!("version = \"", env!("CARGO_PKG_VERSION"), "\"")] //! # this is necessary to automatically initialize the Python interpreter //! features = ["auto-initialize"] //! ``` @@ -439,7 +435,7 @@ pub use pyo3_macros::{pyfunction, pymethods, pymodule, FromPyObject}; /// A proc macro used to expose Rust structs and fieldless enums as Python objects. /// -#[cfg_attr(docsrs, cfg_attr(docsrs, doc = include_str!("../guide/pyclass_parameters.md")))] +#[doc = include_str!("../guide/pyclass_parameters.md")] /// /// For more on creating Python classes, /// see the [class section of the guide][1].