Skip to content

Commit 48733b4

Browse files
committed
Rm hiding feature gate & add 1 more example
1 parent 43c76d1 commit 48733b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

library/core/src/array/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ impl<T, const N: usize> [T; N] {
374374
/// # Examples
375375
///
376376
/// ```
377-
/// # #![feature(array_map)]
377+
/// #![feature(array_map)]
378378
/// let x = [1, 2, 3];
379379
/// let y = x.map(|v| v + 1);
380380
/// assert_eq!(y, [2, 3, 4]);
@@ -383,6 +383,10 @@ impl<T, const N: usize> [T; N] {
383383
/// let mut temp = 0;
384384
/// let y = x.map(|v| { temp += 1; v * temp });
385385
/// assert_eq!(y, [1, 4, 9]);
386+
///
387+
/// let x = ["Ferris", "Bueller's", "Day", "Off"];
388+
/// let y = x.map(|v| v.len());
389+
/// assert_eq!(y, [6, 9, 3, 3]);
386390
/// ```
387391
#[unstable(feature = "array_map", issue = "75243")]
388392
pub fn map<F, U>(self, mut f: F) -> [U; N]

0 commit comments

Comments
 (0)