]> git.lizzy.rs Git - rust.git/commitdiff
Simplify `Layout::extend_packed`
authorMatthew Kraai <kraai@ftbfs.org>
Fri, 6 Dec 2019 17:09:56 +0000 (09:09 -0800)
committerMatthew Kraai <kraai@ftbfs.org>
Sun, 8 Dec 2019 02:23:21 +0000 (21:23 -0500)
src/libcore/alloc.rs

index 20248f7f6c13e374e471f423a37b48ef14556f24..d8e9fe5fbe2f714d63814ede34e1f7bcba302388 100644 (file)
@@ -310,8 +310,7 @@ pub fn repeat_packed(&self, n: usize) -> Result<Self, LayoutErr> {
     pub fn extend_packed(&self, next: Self) -> Result<Self, LayoutErr> {
         let new_size = self.size().checked_add(next.size())
             .ok_or(LayoutErr { private: () })?;
-        let layout = Layout::from_size_align(new_size, self.align())?;
-        Ok(layout)
+        Layout::from_size_align(new_size, self.align())
     }
 
     /// Creates a layout describing the record for a `[T; n]`.