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 13, 2022
1 parent c8e5ac4 commit bbcdebd
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 bbcdebd

Please sign in to comment.