mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-14 07:06:42 +01:00
Reduce overuse of where
clauses in wire.rs
rustfmt blows up `where` clauses even for trivial lines, so we should generally avoid them where possible. Here we remove some extra ones from `wire.rs`.
This commit is contained in:
parent
c9a7bfe40f
commit
4b62c412a6
1 changed files with 6 additions and 6 deletions
|
@ -47,7 +47,7 @@ impl<T> TestEq for T {}
|
|||
#[allow(missing_docs)]
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
pub(crate) enum Message<T> where T: core::fmt::Debug + Type + TestEq {
|
||||
pub(crate) enum Message<T: core::fmt::Debug + Type + TestEq> {
|
||||
Init(msgs::Init),
|
||||
Error(msgs::ErrorMessage),
|
||||
Warning(msgs::WarningMessage),
|
||||
|
@ -105,7 +105,7 @@ pub(crate) enum Message<T> where T: core::fmt::Debug + Type + TestEq {
|
|||
Custom(T),
|
||||
}
|
||||
|
||||
impl<T> Writeable for Message<T> where T: core::fmt::Debug + Type + TestEq {
|
||||
impl<T: core::fmt::Debug + Type + TestEq> Writeable for Message<T> {
|
||||
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
|
||||
match self {
|
||||
&Message::Init(ref msg) => msg.write(writer),
|
||||
|
@ -164,7 +164,7 @@ impl<T> Writeable for Message<T> where T: core::fmt::Debug + Type + TestEq {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Type for Message<T> where T: core::fmt::Debug + Type + TestEq {
|
||||
impl<T: core::fmt::Debug + Type + TestEq> Type for Message<T> {
|
||||
/// Returns the type that was used to decode the message payload.
|
||||
fn type_id(&self) -> u16 {
|
||||
match self {
|
||||
|
@ -224,7 +224,7 @@ impl<T> Type for Message<T> where T: core::fmt::Debug + Type + TestEq {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Message<T> where T: core::fmt::Debug + Type + TestEq {
|
||||
impl<T: core::fmt::Debug + Type + TestEq> Message<T> {
|
||||
/// Returns whether the message's type is even, indicating both endpoints must support it.
|
||||
pub fn is_even(&self) -> bool {
|
||||
(self.type_id() & 1) == 0
|
||||
|
@ -447,12 +447,12 @@ impl Type for () {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl<T: core::fmt::Debug + Writeable + PartialEq> Type for T where T: Encode {
|
||||
impl<T: Encode + Writeable + core::fmt::Debug + PartialEq> Type for T {
|
||||
fn type_id(&self) -> u16 { T::TYPE }
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
impl<T: core::fmt::Debug + Writeable> Type for T where T: Encode {
|
||||
impl<T: Encode + core::fmt::Debug + Writeable> Type for T {
|
||||
fn type_id(&self) -> u16 { T::TYPE }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue