Skip to content

Commit 3551008

Browse files
authored
Update set.rs
1 parent bd80e7b commit 3551008

File tree

1 file changed

+2
-4
lines changed
  • src/libstd/collections/hash

1 file changed

+2
-4
lines changed

src/libstd/collections/hash/set.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,10 @@ const INITIAL_CAPACITY: usize = 32;
106106
///
107107
/// fn main() {
108108
/// let viking_names: HashSet<&str> =
109-
/// [ "Einar", "Olaf", "Harald" ].iter().map(|&x| x).collect();
110-
/// // use the values store in the set
109+
/// [ "Einar", "Olaf", "Harald" ].iter().cloned().collect();
110+
/// // use the values stored in the set
111111
/// }
112112
/// ```
113-
/// This works for Copy types, if you want to cover non-copy types then you need to replace
114-
/// the map(|&x| x) with map(|x| x.clone())
115113
116114

117115
#[derive(Clone)]

0 commit comments

Comments
 (0)