Fix Display impl for NegotiationError. (#1243)

This commit is contained in:
Roman Borschel
2019-09-10 10:16:15 +02:00
committed by GitHub
parent c6e8e6328a
commit e177486ca8

View File

@@ -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.")
}
}
}