Skip to content

Commit 13b3f47

Browse files
committed
Merge #147: Rename EncodeError::Write variant to Fmt
3e729c3 Rename EncodeError::Write variant to Fmt (Tobin C. Harding) Pull request description: We typically refer to a "fmt" being an object that implements `fmt::Write` e.g, `encode_to_fmt()`. Currently we are using the variant name `Write` for an error variant that holds a `fmt::Error`, while this is correct in a way it is also confusing because we may one day have an `io::Error` (coming from a `io::Write` writer). Use `EncodeError::Fmt` instead of `Write`. ACKs for top commit: apoelstra: ACK 3e729c3 Tree-SHA512: 35073fe871830a15762e541547ef7e0fcbd18ef6aabe0bdd84a0c6bfadea65eb345482f6c0275f3497a30ae2c994454a18a29e22386cb94b67a6fe735a9d8ff5
2 parents e4c61b5 + 3e729c3 commit 13b3f47

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
@@ -297,7 +297,7 @@ pub enum EncodeError {
297297
/// Invalid witness length.
298298
WitnessLength(WitnessLengthError),
299299
/// Writing to formatter failed.
300-
Write(fmt::Error),
300+
Fmt(fmt::Error),
301301
}
302302

303303
impl fmt::Display for EncodeError {
@@ -307,7 +307,7 @@ impl fmt::Display for EncodeError {
307307
match *self {
308308
WitnessVersion(ref e) => write_err!(f, "witness version"; e),
309309
WitnessLength(ref e) => write_err!(f, "witness length"; e),
310-
Write(ref e) => write_err!(f, "writing to formatter failed"; e),
310+
Fmt(ref e) => write_err!(f, "writing to formatter failed"; e),
311311
}
312312
}
313313
}
@@ -320,7 +320,7 @@ impl std::error::Error for EncodeError {
320320
match *self {
321321
WitnessVersion(ref e) => Some(e),
322322
WitnessLength(ref e) => Some(e),
323-
Write(ref e) => Some(e),
323+
Fmt(ref e) => Some(e),
324324
}
325325
}
326326
}
@@ -337,7 +337,7 @@ impl From<WitnessLengthError> for EncodeError {
337337

338338
impl From<fmt::Error> for EncodeError {
339339
#[inline]
340-
fn from(e: fmt::Error) -> Self { Self::Write(e) }
340+
fn from(e: fmt::Error) -> Self { Self::Fmt(e) }
341341
}
342342

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

0 commit comments

Comments
 (0)