diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index bea62779bf81d..ac3d84718d54e 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -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