Use ? instead of match
This commit is contained in:
parent
a5fecc6905
commit
07911879d2
@ -326,10 +326,8 @@ impl Layout {
|
||||
let alloc_size = padded_size.checked_mul(n).ok_or(LayoutError)?;
|
||||
|
||||
// The safe constructor is called here to enforce the isize size limit.
|
||||
match Layout::from_size_alignment(alloc_size, self.align) {
|
||||
Ok(layout) => Ok((layout, padded_size)),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
let layout = Layout::from_size_alignment(alloc_size, self.align)?;
|
||||
Ok((layout, padded_size))
|
||||
}
|
||||
|
||||
/// Creates a layout describing the record for `self` followed by
|
||||
|
Loading…
x
Reference in New Issue
Block a user