From 760f0715dd6df8978442ccab855fe3576e7947c7 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 23 Dec 2024 14:28:14 +1100 Subject: [PATCH] units: Make amount::error module private The `untis::error` module is just a code organisation thing it should never have been public. We already re-export all the error types and this is verified by the `units/tests/api.rs` test file. Make the module private and remove it from the paths in the `api` test. --- units/src/amount/mod.rs | 2 +- units/tests/api.rs | 31 +++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/units/src/amount/mod.rs b/units/src/amount/mod.rs index cd16a8552..f340b90da 100644 --- a/units/src/amount/mod.rs +++ b/units/src/amount/mod.rs @@ -5,7 +5,7 @@ //! This module mainly introduces the [`Amount`] and [`SignedAmount`] types. //! We refer to the documentation on the types for more information. -pub mod error; +mod error; #[cfg(feature = "serde")] pub mod serde; diff --git a/units/tests/api.rs b/units/tests/api.rs index 44eee3d9c..6fb84cfaf 100644 --- a/units/tests/api.rs +++ b/units/tests/api.rs @@ -124,17 +124,17 @@ struct Errors { i: amount::PossiblyConfusingDenominationError, j: amount::TooPreciseError, k: amount::UnknownDenominationError, - l: amount::error::InputTooLargeError, - m: amount::error::InvalidCharacterError, - n: amount::error::MissingDenominationError, - o: amount::error::MissingDigitsError, - p: amount::error::OutOfRangeError, - q: amount::error::ParseAmountError, - r: amount::error::ParseDenominationError, - s: amount::error::ParseError, - t: amount::error::PossiblyConfusingDenominationError, - u: amount::error::TooPreciseError, - v: amount::error::UnknownDenominationError, + l: amount::InputTooLargeError, + m: amount::InvalidCharacterError, + n: amount::MissingDenominationError, + o: amount::MissingDigitsError, + p: amount::OutOfRangeError, + q: amount::ParseAmountError, + r: amount::ParseDenominationError, + s: amount::ParseError, + t: amount::PossiblyConfusingDenominationError, + u: amount::TooPreciseError, + v: amount::UnknownDenominationError, w: block::TooBigForRelativeBlockHeightError, x: locktime::absolute::ConversionError, y: locktime::absolute::Height, @@ -166,15 +166,6 @@ fn api_can_use_all_types_from_module_amount() { }; } -#[test] -fn api_can_use_all_types_from_module_amount_error() { - use bitcoin_units::amount::error::{ - InputTooLargeError, InvalidCharacterError, MissingDenominationError, MissingDigitsError, - OutOfRangeError, ParseAmountError, ParseDenominationError, ParseError, - PossiblyConfusingDenominationError, TooPreciseError, UnknownDenominationError, - }; -} - #[test] fn api_can_use_all_types_from_module_block() { use bitcoin_units::block::{BlockHeight, BlockInterval, TooBigForRelativeBlockHeightError};