Skip to content

Commit e611a3f

Browse files
committed
Apply suggestions from code review
1 parent 3fc5593 commit e611a3f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/libstd/keyword_docs.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -1479,17 +1479,28 @@ mod true_keyword {}
14791479
/// assert_eq!(m, k);
14801480
/// ```
14811481
///
1482-
/// In traits, using `type` allows the usage of an associated type without
1483-
/// knowing about it when declaring the [`trait`]:
1482+
/// In traits, `type` is used to declare an [associated type]:
14841483
///
14851484
/// ```rust
14861485
/// trait Iterator {
1486+
/// // associated type declaration
14871487
/// type Item;
14881488
/// fn next(&mut self) -> Option<Self::Item>;
14891489
/// }
1490+
///
1491+
/// struct Once<T>(Option<T>);
1492+
///
1493+
/// impl<T> Iterator for Once<T> {
1494+
/// // associated type definition
1495+
/// type Item = T;
1496+
/// fn next(&mut self) -> Option<Self::Item> {
1497+
/// self.0.take()
1498+
/// }
1499+
/// }
14901500
/// ```
14911501
///
14921502
/// [`trait`]: keyword.trait.html
1503+
/// [associated type]: ../reference/items/associated-items.html#associated-types
14931504
mod type_keyword {}
14941505

14951506
#[doc(keyword = "unsafe")]

0 commit comments

Comments
 (0)