Skip to content

Commit

Permalink
Use ? instead of match
Browse files Browse the repository at this point in the history
  • Loading branch information
CraftSpider committed Nov 20, 2022
1 parent a5fecc6 commit 0791187
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions library/core/src/alloc/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0791187

Please sign in to comment.