Skip to content

Commit

Permalink
Fix Display impl for NegotiationError. (#1243)
Browse files Browse the repository at this point in the history
  • Loading branch information
romanb authored Sep 10, 2019
1 parent c6e8e63 commit e177486
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion misc/multistream-select/src/negotiated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,12 @@ impl Error for NegotiationError {

impl fmt::Display for NegotiationError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
write!(fmt, "{}", Error::description(self))
match self {
NegotiationError::ProtocolError(p) =>
fmt.write_fmt(format_args!("Protocol error: {}", p)),
NegotiationError::Failed =>
fmt.write_str("Protocol negotiation failed.")
}
}
}

Expand Down

0 comments on commit e177486

Please sign in to comment.