From da93caffeecaf7d1c785a8ee2dad2d3da6c2c667 Mon Sep 17 00:00:00 2001 From: totodore Date: Tue, 19 May 2026 09:28:38 +0200 Subject: [PATCH 1/2] docs: build with feature flag tags --- api-error/Cargo.toml | 6 +++++- api-error/src/lib.rs | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api-error/Cargo.toml b/api-error/Cargo.toml index 94f8e8e..1f859c7 100644 --- a/api-error/Cargo.toml +++ b/api-error/Cargo.toml @@ -25,7 +25,7 @@ trybuild = "1" axum = { version = "0.8", default-features = false, features = ["json"] } [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(readme_doctest)'] } +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(readme_doctest)', 'cfg(docsrs)'] } [features] default = ["derive"] @@ -36,3 +36,7 @@ axum = [ "dep:serde_json", "api-error-derive?/axum", ] + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] diff --git a/api-error/src/lib.rs b/api-error/src/lib.rs index 1eb13c8..dc05112 100644 --- a/api-error/src/lib.rs +++ b/api-error/src/lib.rs @@ -1,6 +1,7 @@ // Copyright 2025-Present Centreon // SPDX-License-Identifier: Apache-2.0 #![warn(clippy::pedantic)] +#![cfg_attr(docsrs, feature(doc_cfg))] //! # Api Error //! @@ -322,6 +323,7 @@ pub use ::http as __http; /// #[api_error(message = "Final")] /// ``` #[cfg(feature = "derive")] +#[cfg_attr(docsrs, doc(cfg(feature = "derive")))] pub use api_error_derive::ApiError; /// An error that can be returned by a service API. @@ -376,6 +378,7 @@ pub trait ApiError: std::error::Error { /// Custom implementation for axum integration #[cfg(feature = "axum")] +#[cfg_attr(docsrs, doc(cfg(feature = "axum")))] pub mod axum { use std::{borrow::Cow, sync::OnceLock}; From baa7e8e749421a9dc0500910374eecb2ca79b2d7 Mon Sep 17 00:00:00 2001 From: totodore Date: Tue, 19 May 2026 09:30:57 +0200 Subject: [PATCH 2/2] docs: build with feature flag tags --- api-error/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/api-error/src/lib.rs b/api-error/src/lib.rs index dc05112..3710f84 100644 --- a/api-error/src/lib.rs +++ b/api-error/src/lib.rs @@ -323,7 +323,6 @@ pub use ::http as __http; /// #[api_error(message = "Final")] /// ``` #[cfg(feature = "derive")] -#[cfg_attr(docsrs, doc(cfg(feature = "derive")))] pub use api_error_derive::ApiError; /// An error that can be returned by a service API. @@ -378,7 +377,6 @@ pub trait ApiError: std::error::Error { /// Custom implementation for axum integration #[cfg(feature = "axum")] -#[cfg_attr(docsrs, doc(cfg(feature = "axum")))] pub mod axum { use std::{borrow::Cow, sync::OnceLock};