Use ? instead of match

This commit is contained in:
Rune Tynan 2022-11-13 11:13:32 -05:00
parent a5fecc6905
commit 07911879d2

View File

@ -326,10 +326,8 @@ impl Layout {
let alloc_size = padded_size.checked_mul(n).ok_or(LayoutError)?; let alloc_size = padded_size.checked_mul(n).ok_or(LayoutError)?;
// The safe constructor is called here to enforce the isize size limit. // The safe constructor is called here to enforce the isize size limit.
match Layout::from_size_alignment(alloc_size, self.align) { let layout = Layout::from_size_alignment(alloc_size, self.align)?;
Ok(layout) => Ok((layout, padded_size)), Ok((layout, padded_size))
Err(e) => Err(e),
}
} }
/// Creates a layout describing the record for `self` followed by /// Creates a layout describing the record for `self` followed by