Skip to content

Commit

Permalink
Remove debug_assert from Result::unwrap_unchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Jun 19, 2024
1 parent b2ec216 commit 96bf871
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions library/core/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,6 @@ impl<T, E> Result<T, E> {
#[track_caller]
#[stable(feature = "option_result_unwrap_unchecked", since = "1.58.0")]
pub unsafe fn unwrap_unchecked(self) -> T {
debug_assert!(self.is_ok());
match self {
Ok(t) => t,
// SAFETY: the safety contract must be upheld by the caller.
Expand Down Expand Up @@ -1513,7 +1512,6 @@ impl<T, E> Result<T, E> {
#[track_caller]
#[stable(feature = "option_result_unwrap_unchecked", since = "1.58.0")]
pub unsafe fn unwrap_err_unchecked(self) -> E {
debug_assert!(self.is_err());
match self {
// SAFETY: the safety contract must be upheld by the caller.
Ok(_) => unsafe { hint::unreachable_unchecked() },
Expand Down

0 comments on commit 96bf871

Please sign in to comment.