Skip to content

Commit aba966a

Browse files
authored
Rollup merge of #77194 - pickfire:patch-7, r=withoutboats
Add doc alias for iterator fold fold is known in python and javascript as reduce, not sure about inject but it was written in doc there. This was my first confusion when coming into rust, I somehow cannot find where is reduce, sometimes I still forget that it is known as `fold`.
2 parents 85a59d4 + ea0065a commit aba966a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/core/src/iter/traits/iterator.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1976,6 +1976,8 @@ pub trait Iterator {
19761976
/// // they're the same
19771977
/// assert_eq!(result, result2);
19781978
/// ```
1979+
#[doc(alias = "reduce")]
1980+
#[doc(alias = "inject")]
19791981
#[inline]
19801982
#[stable(feature = "rust1", since = "1.0.0")]
19811983
fn fold<B, F>(mut self, init: B, mut f: F) -> B

0 commit comments

Comments
 (0)