Format the match statement

This commit is contained in:
Lena Wildervanck 2020-03-11 17:30:04 +01:00
parent 88f8b88160
commit 599cd683ea
1 changed files with 6 additions and 3 deletions

View File

@ -85,12 +85,15 @@ impl Display for TryReserveError {
fmt: &mut core::fmt::Formatter<'_>,
) -> core::result::Result<(), core::fmt::Error> {
fmt.write_str("memory allocation failed")?;
fmt.write_str(match &self {
let reason = match &self {
TryReserveError::CapacityOverflow => {
" because the computed capacity exceeded the collection's maximum"
}
TryReserveError::AllocError { .. } => " because the memory allocator returned a error",
})
TryReserveError::AllocError { .. } => {
" because the memory allocator returned a error"
}
};
fmt.write_str(reason)
}
}