Skip to content

Commit 65d412b

Browse files
authored
Rollup merge of #86389 - kpreid:sum, r=scottmcm
Make `sum()` and `product()` documentation hyperlinks refer to `Iterator` methods. The previous linking seemed confusing: within "the sum() method on iterators", "sum()" was linked to `Sum::sum`, not `Iterator::sum`, even though the sentence is talking about the latter. I have rewritten the sentence to be, I believe, clearer, as well as changing the link destinations; applying the same change to the `Product` documentation as well as `Sum`. I reviewed other traits in the same module and did not see similar issues, and previewed the results using `./x.py doc library/std`.
2 parents aff7994 + cb2f8d9 commit 65d412b

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

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

+8-10
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ use crate::num::Wrapping;
33

44
/// Trait to represent types that can be created by summing up an iterator.
55
///
6-
/// This trait is used to implement the [`sum()`] method on iterators. Types which
7-
/// implement the trait can be generated by the [`sum()`] method. Like
8-
/// [`FromIterator`] this trait should rarely be called directly and instead
9-
/// interacted with through [`Iterator::sum()`].
6+
/// This trait is used to implement [`Iterator::sum()`]. Types which implement
7+
/// this trait can be generated by using the [`sum()`] method on an iterator.
8+
/// Like [`FromIterator`], this trait should rarely be called directly.
109
///
11-
/// [`sum()`]: Sum::sum
10+
/// [`sum()`]: Iterator::sum
1211
/// [`FromIterator`]: iter::FromIterator
1312
#[stable(feature = "iter_arith_traits", since = "1.12.0")]
1413
pub trait Sum<A = Self>: Sized {
@@ -21,12 +20,11 @@ pub trait Sum<A = Self>: Sized {
2120
/// Trait to represent types that can be created by multiplying elements of an
2221
/// iterator.
2322
///
24-
/// This trait is used to implement the [`product()`] method on iterators. Types
25-
/// which implement the trait can be generated by the [`product()`] method. Like
26-
/// [`FromIterator`] this trait should rarely be called directly and instead
27-
/// interacted with through [`Iterator::product()`].
23+
/// This trait is used to implement [`Iterator::product()`]. Types which implement
24+
/// this trait can be generated by using the [`product()`] method on an iterator.
25+
/// Like [`FromIterator`], this trait should rarely be called directly.
2826
///
29-
/// [`product()`]: Product::product
27+
/// [`product()`]: Iterator::product
3028
/// [`FromIterator`]: iter::FromIterator
3129
#[stable(feature = "iter_arith_traits", since = "1.12.0")]
3230
pub trait Product<A = Self>: Sized {

0 commit comments

Comments
 (0)