about summary refs log tree commit diff
path: root/library/core/src/array
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2025-08-04 13:10:09 +0000
committerGitHub <noreply@github.com>2025-08-04 13:10:09 +0000
commitee1b237215ee90df2c0102457fa2d0e9c2df8753 (patch)
treed7b99f917db35f8a07550c15b2544e0563612b5e /library/core/src/array
parentee00b998177899c10bea83a38c46627f27496ba2 (diff)
parentab7c35995d9489821cc8b70ac1da069090ee56c9 (diff)
downloadrust-ee1b237215ee90df2c0102457fa2d0e9c2df8753.tar.gz
rust-ee1b237215ee90df2c0102457fa2d0e9c2df8753.zip
Merge pull request #4513 from rust-lang/rustup-2025-08-04
Automatic Rustup
Diffstat (limited to 'library/core/src/array')
-rw-r--r--library/core/src/array/equality.rs28
1 files changed, 12 insertions, 16 deletions
diff --git a/library/core/src/array/equality.rs b/library/core/src/array/equality.rs
index bb668d2a673..1ad2cca64a3 100644
--- a/library/core/src/array/equality.rs
+++ b/library/core/src/array/equality.rs
@@ -22,18 +22,16 @@ where
 {
     #[inline]
     fn eq(&self, other: &[U]) -> bool {
-        let b: Result<&[U; N], _> = other.try_into();
-        match b {
-            Ok(b) => *self == *b,
-            Err(_) => false,
+        match other.as_array::<N>() {
+            Some(b) => *self == *b,
+            None => false,
         }
     }
     #[inline]
     fn ne(&self, other: &[U]) -> bool {
-        let b: Result<&[U; N], _> = other.try_into();
-        match b {
-            Ok(b) => *self != *b,
-            Err(_) => true,
+        match other.as_array::<N>() {
+            Some(b) => *self != *b,
+            None => true,
         }
     }
 }
@@ -45,18 +43,16 @@ where
 {
     #[inline]
     fn eq(&self, other: &[U; N]) -> bool {
-        let b: Result<&[T; N], _> = self.try_into();
-        match b {
-            Ok(b) => *b == *other,
-            Err(_) => false,
+        match self.as_array::<N>() {
+            Some(b) => *b == *other,
+            None => false,
         }
     }
     #[inline]
     fn ne(&self, other: &[U; N]) -> bool {
-        let b: Result<&[T; N], _> = self.try_into();
-        match b {
-            Ok(b) => *b != *other,
-            Err(_) => true,
+        match self.as_array::<N>() {
+            Some(b) => *b != *other,
+            None => true,
         }
     }
 }