From 96bf871f0712bd189e74b1ddef614f7ae842472f Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Wed, 19 Jun 2024 16:31:30 -0400 Subject: [PATCH] Remove debug_assert from Result::unwrap_unchecked --- library/core/src/result.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/library/core/src/result.rs b/library/core/src/result.rs index f8cdcc000c50e..e5a235b2c9909 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1481,7 +1481,6 @@ impl Result { #[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. @@ -1513,7 +1512,6 @@ impl Result { #[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() },