Merge rust-bitcoin/rust-bitcoin#7111: units: remove unused fee_rate serde OverflowError
What changed, and why it matters
This commit removes an unused error type called OverflowError from the fee_rate serde module. The error was no longer needed because the underlying constructor became unable to fail. It is a straightforward cleanup with no security impact.
No security action required. This is a routine code cleanup. Downstream users relying on `bitcoin_units::fee_rate::serde::OverflowError` will need to remove references to it when upgrading.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit deletes the public re-export fee_rate::serde::OverflowError and its definition, along with related test assertions. The PR description states that from_sat constructors became infallible in an earlier commit, making this error type dead code. The diff shows only removals and no functional logic changes.
Changed components
units/src/fee_rate/serde.rsunits/tests/api.rsInspect captured patch +0 / −41
### units/src/fee_rate/serde.rs
@@ -23,9 +23,6 @@
//! }
//! ```
-#[doc(no_inline)]
-pub use self::error::OverflowError;
-
pub mod as_sat_per_kwu_floor {
//! Serialize and deserialize [`FeeRate`] denominated in satoshis per 1000 weight units.
//!
@@ -407,35 +404,3 @@ pub mod as_sat_per_vb_ceil {
}
}
}
-
-/// Error types for fee rate serde handling.
-pub mod error {
- use core::convert::Infallible;
- use core::fmt;
-
- /// Overflow occurred while deserializing fee rate per virtual byte.
- #[derive(Debug, Clone, PartialEq, Eq)]
- #[non_exhaustive]
- pub struct OverflowError;
-
- impl From<Infallible> for OverflowError {
- #[inline]
- fn from(never: Infallible) -> Self { match never {} }
- }
-
- impl fmt::Display for OverflowError {
- #[inline]
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "overflow occurred while deserializing fee rate per virtual byte")
- }
- }
-
- #[cfg(feature = "std")]
- impl std::error::Error for OverflowError {
- #[inline]
- fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- let Self {} = self;
- None
- }
- }
-}
### units/tests/api.rs
@@ -144,8 +144,6 @@ struct Errors {
j: amount::error::TooPreciseError,
k: amount::error::UnknownDenominationError,
l: block::TooBigForRelativeHeightError,
- #[cfg(feature = "serde")]
- m: fee_rate::serde::OverflowError,
n: locktime::absolute::ConversionError,
o: locktime::absolute::ParseHeightError,
p: locktime::absolute::ParseTimeError,
@@ -267,8 +265,6 @@ fn c_good_err_display() {
assert_display::<amount::error::TooPreciseError>();
assert_display::<amount::error::UnknownDenominationError>();
assert_display::<block::TooBigForRelativeHeightError>();
- #[cfg(feature = "serde")]
- assert_display::<fee_rate::serde::OverflowError>();
assert_display::<locktime::absolute::ConversionError>();
assert_display::<locktime::absolute::ParseHeightError>();
assert_display::<locktime::absolute::ParseTimeError>();
@@ -426,8 +422,6 @@ fn p_consistent_exports_sequence() {
/// P-CONSISTENT-EXPORTS: Tests that all types can be imported from the `fee_rate` module.
#[test]
fn p_consistent_exports_fee_rate() {
- #[cfg(feature = "serde")]
- use bitcoin_units::fee_rate::serde::OverflowError;
use bitcoin_units::fee_rate::FeeRate;
}
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.