Skip to content

Commit

Permalink
Simplify BTreeSet::iter doc example.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Dec 7, 2016
1 parent d301dff commit 429f1d9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/libcollections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,12 @@ impl<T> BTreeSet<T> {
/// ```
/// use std::collections::BTreeSet;
///
/// let set: BTreeSet<usize> = [1, 2, 3, 4].iter().cloned().collect();
///
/// for x in set.iter() {
/// println!("{}", x);
/// }
///
/// let v: Vec<_> = set.iter().cloned().collect();
/// assert_eq!(v, [1, 2, 3, 4]);
/// let set: BTreeSet<usize> = [1, 2, 3].iter().cloned().collect();
/// let mut set_iter = set.iter();
/// assert_eq!(set_iter.next(), Some(&1));
/// assert_eq!(set_iter.next(), Some(&2));
/// assert_eq!(set_iter.next(), Some(&3));
/// assert_eq!(set_iter.next(), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> {
Expand Down

0 comments on commit 429f1d9

Please sign in to comment.