diff --git a/units/src/locktime/absolute.rs b/units/src/locktime/absolute.rs index 92283468d..6f87b21bd 100644 --- a/units/src/locktime/absolute.rs +++ b/units/src/locktime/absolute.rs @@ -2,8 +2,6 @@ //! Provides [`Height`] and [`Time`] types used by the `rust-bitcoin` `absolute::LockTime` type. -#[cfg(feature = "alloc")] -use alloc::{boxed::Box, string::String}; use core::fmt; use internals::error::InputString; diff --git a/units/src/parse.rs b/units/src/parse.rs index a2ee0e4db..52ea0e74b 100644 --- a/units/src/parse.rs +++ b/units/src/parse.rs @@ -107,10 +107,9 @@ macro_rules! impl_tryfrom_str_from_int_infallible { #[macro_export] macro_rules! impl_parse_str_from_int_infallible { ($to:ident, $inner:ident, $fn:ident) => { - #[cfg(all(feature = "alloc", not(feature = "std")))] - $crate::impl_tryfrom_str_from_int_infallible!(&str, $to, $inner, $fn; alloc::string::String, $to, $inner, $fn; alloc::boxed::Box, $to, $inner, $fn); - #[cfg(feature = "std")] - $crate::impl_tryfrom_str_from_int_infallible!(&str, $to, $inner, $fn; std::string::String, $to, $inner, $fn; std::boxed::Box, $to, $inner, $fn); + $crate::impl_tryfrom_str_from_int_infallible!(&str, $to, $inner, $fn); + #[cfg(feature = "alloc")] + $crate::impl_tryfrom_str_from_int_infallible!(alloc::string::String, $to, $inner, $fn; alloc::boxed::Box, $to, $inner, $fn); impl core::str::FromStr for $to { type Err = $crate::parse::ParseIntError; @@ -143,7 +142,9 @@ macro_rules! impl_tryfrom_str { #[macro_export] macro_rules! impl_parse_str { ($to:ty, $err:ty, $inner_fn:expr) => { - $crate::impl_tryfrom_str!(&str, $to, $err, $inner_fn; String, $to, $err, $inner_fn; Box, $to, $err, $inner_fn); + $crate::impl_tryfrom_str!(&str, $to, $err, $inner_fn); + #[cfg(feature = "alloc")] + $crate::impl_tryfrom_str!(alloc::string::String, $to, $err, $inner_fn; alloc::boxed::Box, $to, $err, $inner_fn); impl core::str::FromStr for $to { type Err = $err;