diff --git a/internals/src/lib.rs b/internals/src/lib.rs index 353234b5d..ff78d9581 100644 --- a/internals/src/lib.rs +++ b/internals/src/lib.rs @@ -10,6 +10,7 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] // Coding conventions. #![warn(missing_docs)] +#![doc(test(attr(warn(unused))))] // Exclude lints we don't think are valuable. #![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134 #![allow(clippy::manual_range_contains)] // More readable than clippy's format. diff --git a/internals/src/macros.rs b/internals/src/macros.rs index f51f692d3..d0ae5bbb1 100644 --- a/internals/src/macros.rs +++ b/internals/src/macros.rs @@ -158,6 +158,8 @@ macro_rules! const_assert { /// # Examples /// /// ```rust +/// # #[allow(unused)] +/// # fn main() { /// # use core::fmt::{Display, Debug}; /// use bitcoin_internals::impl_from_infallible; /// @@ -167,7 +169,7 @@ macro_rules! const_assert { /// enum BetaEnum<'b> { Item(&'b usize) } /// impl_from_infallible!(BetaEnum<'b>); /// -/// enum GammaEnum { Item(T) }; +/// enum GammaEnum { Item(T) } /// impl_from_infallible!(GammaEnum); /// /// enum DeltaEnum<'b, 'a: 'static + 'b, T: 'a, D: Debug + Display + 'a> { @@ -189,6 +191,7 @@ macro_rules! const_assert { /// what: &'b D, /// } /// impl_from_infallible!(DeltaStruct<'b, 'a: 'static + 'b, T: 'a, D: Debug + Display + 'a>); +/// # } /// ``` /// /// See for more information about this macro. @@ -208,7 +211,7 @@ macro_rules! impl_from_infallible { /// Adds an implementation of `pub fn to_hex(&self) -> String` if `alloc` feature is enabled. /// /// The added function allocates a `String` then calls through to [`core::fmt::LowerHex`]. -/// +/// /// Note: Calling this macro assumes that the calling crate has an `alloc` feature that also activates the /// `alloc` crate. Calling this macro without the `alloc` feature enabled is a no-op. #[macro_export]