From 07911879d2bea1b28aee16451e4a532462d55b00 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Sun, 13 Nov 2022 11:13:32 -0500 Subject: [PATCH] Use ? instead of match --- library/core/src/alloc/layout.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index bea62779bf8..ac3d84718d5 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