about summary refs log tree commit diff
path: root/library/core/src/alloc/layout.rs
diff options
context:
space:
mode:
authorRune Tynan <runetynan@gmail.com>2022-11-13 11:13:32 -0500
committerRune Tynan <runetynan@gmail.com>2022-11-20 15:01:22 -0500
commit07911879d2bea1b28aee16451e4a532462d55b00 (patch)
tree118fb275a56947038a6d577a20000522a67af315 /library/core/src/alloc/layout.rs
parenta5fecc690562f23ffe95a0e167bf0a57eca725ad (diff)
downloadrust-07911879d2bea1b28aee16451e4a532462d55b00.tar.gz
rust-07911879d2bea1b28aee16451e4a532462d55b00.zip
Use ? instead of match
Diffstat (limited to 'library/core/src/alloc/layout.rs')
-rw-r--r--library/core/src/alloc/layout.rs6
1 files 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