Skip to content

Commit e904791

Browse files
committed
Drop std::error::Error impl for DecodeError
It appears to be effectively-deprecated in Rust now, and didn't really appear to serve a lot of purpose anyway.
1 parent 5c878c2 commit e904791

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

lightning/src/ln/msgs.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use bitcoin::blockdata::script::Script;
2323

2424
use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
2525

26-
use std::error::Error;
2726
use std::{cmp, fmt};
2827
use std::io::Read;
2928
use std::result::Result;
@@ -688,21 +687,16 @@ pub(crate) struct OnionErrorPacket {
688687
pub(crate) data: Vec<u8>,
689688
}
690689

691-
impl Error for DecodeError {
692-
fn description(&self) -> &str {
693-
match *self {
694-
DecodeError::UnknownVersion => "Unknown realm byte in Onion packet",
695-
DecodeError::UnknownRequiredFeature => "Unknown required feature preventing decode",
696-
DecodeError::InvalidValue => "Nonsense bytes didn't map to the type they were interpreted as",
697-
DecodeError::ShortRead => "Packet extended beyond the provided bytes",
698-
DecodeError::BadLengthDescriptor => "A length descriptor in the packet didn't describe the later data correctly",
699-
DecodeError::Io(ref e) => e.description(),
700-
}
701-
}
702-
}
703690
impl fmt::Display for DecodeError {
704691
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
705-
f.write_str(self.description())
692+
match *self {
693+
DecodeError::UnknownVersion => f.write_str("Unknown realm byte in Onion packet"),
694+
DecodeError::UnknownRequiredFeature => f.write_str("Unknown required feature preventing decode"),
695+
DecodeError::InvalidValue => f.write_str("Nonsense bytes didn't map to the type they were interpreted as"),
696+
DecodeError::ShortRead => f.write_str("Packet extended beyond the provided bytes"),
697+
DecodeError::BadLengthDescriptor => f.write_str("A length descriptor in the packet didn't describe the later data correctly"),
698+
DecodeError::Io(ref e) => e.fmt(f),
699+
}
706700
}
707701
}
708702

0 commit comments

Comments
 (0)