Allow unused in `macros.rs` docs
The example code in macros.rs is much clearer as it is than changing it to remove the warnings created by adding the warn attribute to the `lib.rs` file. The example code was enclosed within a function block and `#[allow(unused)]` added. And a warn attribute added to `lib.rs`.
This commit is contained in:
parent
fd89ddf401
commit
f6abdcc001
|
@ -10,6 +10,7 @@
|
||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
// Coding conventions.
|
// Coding conventions.
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
#![doc(test(attr(warn(unused))))]
|
||||||
// Exclude lints we don't think are valuable.
|
// Exclude lints we don't think are valuable.
|
||||||
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
#![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.
|
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
|
||||||
|
|
|
@ -158,6 +158,8 @@ macro_rules! const_assert {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
|
/// # #[allow(unused)]
|
||||||
|
/// # fn main() {
|
||||||
/// # use core::fmt::{Display, Debug};
|
/// # use core::fmt::{Display, Debug};
|
||||||
/// use bitcoin_internals::impl_from_infallible;
|
/// use bitcoin_internals::impl_from_infallible;
|
||||||
///
|
///
|
||||||
|
@ -167,7 +169,7 @@ macro_rules! const_assert {
|
||||||
/// enum BetaEnum<'b> { Item(&'b usize) }
|
/// enum BetaEnum<'b> { Item(&'b usize) }
|
||||||
/// impl_from_infallible!(BetaEnum<'b>);
|
/// impl_from_infallible!(BetaEnum<'b>);
|
||||||
///
|
///
|
||||||
/// enum GammaEnum<T> { Item(T) };
|
/// enum GammaEnum<T> { Item(T) }
|
||||||
/// impl_from_infallible!(GammaEnum<T>);
|
/// impl_from_infallible!(GammaEnum<T>);
|
||||||
///
|
///
|
||||||
/// enum DeltaEnum<'b, 'a: 'static + 'b, T: 'a, D: Debug + Display + 'a> {
|
/// enum DeltaEnum<'b, 'a: 'static + 'b, T: 'a, D: Debug + Display + 'a> {
|
||||||
|
@ -189,6 +191,7 @@ macro_rules! const_assert {
|
||||||
/// what: &'b D,
|
/// what: &'b D,
|
||||||
/// }
|
/// }
|
||||||
/// impl_from_infallible!(DeltaStruct<'b, 'a: 'static + 'b, T: 'a, D: Debug + Display + 'a>);
|
/// impl_from_infallible!(DeltaStruct<'b, 'a: 'static + 'b, T: 'a, D: Debug + Display + 'a>);
|
||||||
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// See <https://stackoverflow.com/a/61189128> for more information about this macro.
|
/// See <https://stackoverflow.com/a/61189128> 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.
|
/// 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`].
|
/// 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
|
/// 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.
|
/// `alloc` crate. Calling this macro without the `alloc` feature enabled is a no-op.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|
Loading…
Reference in New Issue