about summary refs log tree commit diff
path: root/library/core/src/array
diff options
context:
space:
mode:
authoribraheemdev <ibrah1440@gmail.com>2021-08-30 16:13:56 -0400
committeribraheemdev <ibrah1440@gmail.com>2021-08-30 16:13:56 -0400
commitb99038f4780d918224cd1aed6da2f9d6b42e7481 (patch)
treeaa69c738cabbcf95d33f76a0001c3bfb3e3d145e /library/core/src/array
parent6cfa773583bb5123e630668f5bfe466716225546 (diff)
downloadrust-b99038f4780d918224cd1aed6da2f9d6b42e7481.tar.gz
rust-b99038f4780d918224cd1aed6da2f9d6b42e7481.zip
use `unwrap_unchecked` where possible
Diffstat (limited to 'library/core/src/array')
-rw-r--r--library/core/src/array/mod.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 3c638e655dc..70cccd31b92 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -459,11 +459,8 @@ where
     debug_assert!(N <= iter.size_hint().1.unwrap_or(usize::MAX));
     debug_assert!(N <= iter.size_hint().0);
 
-    match collect_into_array(iter) {
-        Some(array) => array,
-        // SAFETY: covered by the function contract.
-        None => unsafe { crate::hint::unreachable_unchecked() },
-    }
+    // SAFETY: covered by the function contract.
+    unsafe { collect_into_array(iter).unwrap_unchecked() }
 }
 
 /// Pulls `N` items from `iter` and returns them as an array. If the iterator