Remove From<Infallible> on inner error types
What changed, and why it matters
This commit removes unused helper code that converted the impossible-to-create Infallible error type into several private inner error types. These inner types are not exposed to users of the library, and the removed conversions served no internal purpose. There is no security-relevant change.
No action required. This is a non-security cleanup commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes From
Changed components
base58/src/error.rsunits/src/amount/error.rsunits/src/parse_int.rsInspect captured patch +0 / −24
diff --git a/base58/src/error.rs b/base58/src/error.rs
index 25c16cc4..2daacf1a 100644
--- a/base58/src/error.rs
+++ b/base58/src/error.rs
@@ -51,10 +51,6 @@ impl From<Infallible> for Error {
fn from(never: Infallible) -> Self { match never {} }
}
-impl From<Infallible> for ErrorInner {
- fn from(never: Infallible) -> Self { match never {} }
-}
-
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use ErrorInner::{Decode, IncorrectChecksum, TooShort};
@@ -172,10 +168,6 @@ impl From<Infallible> for InvalidCharacterError {
fn from(never: Infallible) -> Self { match never {} }
}
-impl From<Infallible> for InvalidCharacterErrorInner {
- fn from(never: Infallible) -> Self { match never {} }
-}
-
impl fmt::Display for InvalidCharacterError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "invalid base58 character {:#x}", self.0.invalid)
diff --git a/units/src/amount/error.rs b/units/src/amount/error.rs
index 3fa11e63..508dc753 100644
--- a/units/src/amount/error.rs
+++ b/units/src/amount/error.rs
@@ -29,10 +29,6 @@ impl From<Infallible> for ParseError {
fn from(never: Infallible) -> Self { match never {} }
}
-impl From<Infallible> for ParseErrorInner {
- fn from(never: Infallible) -> Self { match never {} }
-}
-
impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.0 {
@@ -84,10 +80,6 @@ impl From<Infallible> for ParseAmountError {
fn from(never: Infallible) -> Self { match never {} }
}
-impl From<Infallible> for ParseAmountErrorInner {
- fn from(never: Infallible) -> Self { match never {} }
-}
-
impl fmt::Display for ParseAmountError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use ParseAmountErrorInner as E;
diff --git a/units/src/parse_int.rs b/units/src/parse_int.rs
index fe859b81..1347eb16 100644
--- a/units/src/parse_int.rs
+++ b/units/src/parse_int.rs
@@ -470,10 +470,6 @@ pub mod error {
fn from(never: Infallible) -> Self { match never {} }
}
- impl From<Infallible> for PrefixedHexErrorInner {
- fn from(never: Infallible) -> Self { match never {} }
- }
-
impl fmt::Display for PrefixedHexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use PrefixedHexErrorInner as E;
@@ -514,10 +510,6 @@ pub mod error {
fn from(never: Infallible) -> Self { match never {} }
}
- impl From<Infallible> for UnprefixedHexErrorInner {
- fn from(never: Infallible) -> Self { match never {} }
- }
-
impl fmt::Display for UnprefixedHexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use UnprefixedHexErrorInner as E;
Why this scored 15/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.