about summary refs log tree commit diff
path: root/library/core/src/array
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-06-10 17:55:28 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-06-11 01:50:43 -0700
commitd6955445f53062a8af3e5a4e84dbf756a7913cbe (patch)
treedd75a61bf158ba9381e3f0519c524eb9fe3b5981 /library/core/src/array
parentb5b13568fb5da4ac988bde370008d6134d3dfe6c (diff)
downloadrust-d6955445f53062a8af3e5a4e84dbf756a7913cbe.tar.gz
rust-d6955445f53062a8af3e5a4e84dbf756a7913cbe.zip
Simplify `[T; N]::try_map` signature
People keep making fun of this signature for being so gnarly.
Associated type bounds lend it a much simpler scribbling.
ChangeOutputType can also come along for the ride.
Diffstat (limited to 'library/core/src/array')
-rw-r--r--library/core/src/array/mod.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 05874ab6c4c..2569ce23707 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -533,11 +533,9 @@ impl<T, const N: usize> [T; N] {
     /// assert_eq!(c, Some(a));
     /// ```
     #[unstable(feature = "array_try_map", issue = "79711")]
-    pub fn try_map<F, R>(self, f: F) -> ChangeOutputType<R, [R::Output; N]>
+    pub fn try_map<R>(self, f: impl FnMut(T) -> R) -> ChangeOutputType<R, [R::Output; N]>
     where
-        F: FnMut(T) -> R,
-        R: Try,
-        R::Residual: Residual<[R::Output; N]>,
+        R: Try<Residual: Residual<[R::Output; N]>>,
     {
         drain_array_with(self, |iter| try_from_trusted_iterator(iter.map(f)))
     }