Skip to content

Commit 69d562d

Browse files
change example of array_from_fn to match suggestion
1 parent 480f850 commit 69d562d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/core/src/array/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ pub use iter::IntoIter;
3838
/// // equal lengths can be compared, so the const generic parameter `N` is
3939
/// // inferred to be 5, thus creating array of 5 elements.
4040
///
41-
/// let array: [_; 5] = core::array::from_fn(|i| i);
41+
/// let array = core::array::from_fn(|i| i);
4242
/// // indexes are: 0 1 2 3 4
4343
/// assert_eq!(array, [0, 1, 2, 3, 4]);
4444
///
45-
/// let array2: [_; 8] = core::array::from_fn(|i| i * 2);
45+
/// let array2: [usize; 8] = core::array::from_fn(|i| i * 2);
4646
/// // indexes are: 0 1 2 3 4 5 6 7
4747
/// assert_eq!(array2, [0, 2, 4, 6, 8, 10, 12, 14]);
4848
///
49-
/// let bool_arr: [bool; 5] = core::array::from_fn(|i| i % 2 == 0);
49+
/// let bool_arr = core::array::from_fn::<_, 5, _>(|i| i % 2 == 0);
5050
/// // indexes are: 0 1 2 3 4
5151
/// assert_eq!(bool_arr, [true, false, true, false, true]);
5252
/// ```

0 commit comments

Comments
 (0)