Skip to content

Commit 2b60efb

Browse files
committed
segwit: Rename EncodeError::Write variant to Fmt
Its cleaner if both the `lib.rs` `EncodeError` and the `segwit::EncodeError` use variants named uniformly. In preparation for adding `Write` and `Fmt` variants (for `std::io::Write` and `fmt::Write` respectively) to the `EncodeError` in `lib.rs` rename the current `EncodeError::Write(fmt::Error)` variant to `Fmt`.
1 parent 923a0ef commit 2b60efb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/segwit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ pub enum EncodeError {
381381
/// Encoding HRP, witver, and program into a bech32 string exceeds limit of 90 characters.
382382
TooLong(EncodedLengthError),
383383
/// Writing to formatter failed.
384-
Write(fmt::Error),
384+
Fmt(fmt::Error),
385385
}
386386

387387
impl fmt::Display for EncodeError {
@@ -392,7 +392,7 @@ impl fmt::Display for EncodeError {
392392
WitnessVersion(ref e) => write_err!(f, "witness version"; e),
393393
WitnessLength(ref e) => write_err!(f, "witness length"; e),
394394
TooLong(ref e) => write_err!(f, "encoded string too long"; e),
395-
Write(ref e) => write_err!(f, "writing to formatter failed"; e),
395+
Fmt(ref e) => write_err!(f, "writing to formatter failed"; e),
396396
}
397397
}
398398
}
@@ -406,7 +406,7 @@ impl std::error::Error for EncodeError {
406406
WitnessVersion(ref e) => Some(e),
407407
WitnessLength(ref e) => Some(e),
408408
TooLong(ref e) => Some(e),
409-
Write(ref e) => Some(e),
409+
Fmt(ref e) => Some(e),
410410
}
411411
}
412412
}
@@ -428,7 +428,7 @@ impl From<EncodedLengthError> for EncodeError {
428428

429429
impl From<fmt::Error> for EncodeError {
430430
#[inline]
431-
fn from(e: fmt::Error) -> Self { Self::Write(e) }
431+
fn from(e: fmt::Error) -> Self { Self::Fmt(e) }
432432
}
433433

434434
#[cfg(all(test, feature = "alloc"))]

0 commit comments

Comments
 (0)