Merge rust-bitcoin/rust-bitcoin#3295: internals: Fix lint warnings on macro
514cc5500f
internals: Fix lint warnings on macro (Tobin C. Harding) Pull request description: The new `impl_to_hex_from_lower_hex` macro causes build warnings when `internals` is built without the `alloc` feature. There are two macro implementations depending on feature gates, duplicate the rustdocs from the other one. While we are at it reduce the lines of code for the empty case. ACKs for top commit: Kixunil: ACK514cc5500f
apoelstra: ACK514cc5500f
successfully ran local tests Tree-SHA512: f6a8929f53be77fed3703858b757fc94bd986dccde417a1cbd8edda67e08f4ff4dc76d5eff7f09a0482a05c9ea330cc45e970f3549fbd0b5f35683dd0243e2a1
This commit is contained in:
commit
4cc14d9df8
|
@ -205,7 +205,10 @@ macro_rules! impl_from_infallible {
|
|||
}
|
||||
}
|
||||
|
||||
/// Implements `to_hex` for functions that have implemented [`core::fmt::LowerHex`]
|
||||
/// 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`].
|
||||
/// Calling this macro without the `alloc` feature enabled is a noop.
|
||||
#[macro_export]
|
||||
#[cfg(feature = "alloc")]
|
||||
macro_rules! impl_to_hex_from_lower_hex {
|
||||
|
@ -224,6 +227,10 @@ macro_rules! impl_to_hex_from_lower_hex {
|
|||
};
|
||||
}
|
||||
|
||||
/// 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`].
|
||||
/// Calling this macro without the `alloc` feature enabled is a noop.
|
||||
#[macro_export]
|
||||
#[cfg(not(feature = "alloc"))]
|
||||
macro_rules! impl_to_hex_from_lower_hex {
|
||||
|
|
Loading…
Reference in New Issue