Implement matches! macro (#1777)

Fix #1775
This commit is contained in:
Herman Junge
2020-10-15 21:42:43 +00:00
parent 97be2ca295
commit d7b9d0dd9f
8 changed files with 19 additions and 62 deletions

View File

@@ -277,10 +277,7 @@ impl<T: EthSpec> RPCCodedResponse<T> {
/// Tells the codec whether to decode as an RPCResponse or an error.
pub fn is_response(response_code: u8) -> bool {
match response_code {
0 => true,
_ => false,
}
matches!(response_code, 0)
}
/// Builds an RPCCodedResponse from a response code and an ErrorMessage
@@ -311,10 +308,7 @@ impl<T: EthSpec> RPCCodedResponse<T> {
/// Returns true if this response always terminates the stream.
pub fn close_after(&self) -> bool {
match self {
RPCCodedResponse::Success(_) => false,
_ => true,
}
!matches!(self, RPCCodedResponse::Success(_))
}
}