diff --git a/units/src/parse.rs b/units/src/parse.rs index 7e436a5a1..5e88fce0a 100644 --- a/units/src/parse.rs +++ b/units/src/parse.rs @@ -52,18 +52,24 @@ impl AsRef for ParseIntError { /// Not strictly necessary but serves as a lint - avoids weird behavior if someone accidentally /// passes non-integer to the `parse()` function. -pub trait Integer: FromStr + TryFrom + Sized {} +pub trait Integer: FromStr + TryFrom + Sized + sealed::Sealed {} macro_rules! impl_integer { ($($type:ty),* $(,)?) => { $( impl Integer for $type {} + impl sealed::Sealed for $type {} )* } } impl_integer!(u8, i8, u16, i16, u32, i32, u64, i64, u128, i128); +mod sealed { + /// Seals the extension traits. + pub trait Sealed {} +} + /// Parses the input string as an integer returning an error carrying rich context. /// /// If the caller owns `String` or `Box` which is not used later it's better to pass it as