Skip to content

Commit 0791187

Browse files
committed
Use ? instead of match
1 parent a5fecc6 commit 0791187

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

library/core/src/alloc/layout.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,8 @@ impl Layout {
326326
let alloc_size = padded_size.checked_mul(n).ok_or(LayoutError)?;
327327

328328
// The safe constructor is called here to enforce the isize size limit.
329-
match Layout::from_size_alignment(alloc_size, self.align) {
330-
Ok(layout) => Ok((layout, padded_size)),
331-
Err(e) => Err(e),
332-
}
329+
let layout = Layout::from_size_alignment(alloc_size, self.align)?;
330+
Ok((layout, padded_size))
333331
}
334332

335333
/// Creates a layout describing the record for `self` followed by

0 commit comments

Comments
 (0)