Skip to content

Commit acdce63

Browse files
committed
Tidy up the HashMap.mangle example.
1 parent 460b552 commit acdce63

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/libcollections/hashmap.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,15 +1275,14 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
12751275
/// use collections::HashMap;
12761276
///
12771277
/// // map some strings to vectors of strings
1278-
/// let mut map = HashMap::<StrBuf, Vec<StrBuf>>::new();
1279-
/// map.insert(StrBuf::from_str("a key"), vec![StrBuf::from_str("value")]);
1280-
/// map.insert(StrBuf::from_str("z key"), vec![StrBuf::from_str("value")]);
1278+
/// let mut map = HashMap::new();
1279+
/// map.insert("a key", vec!["value"]);
1280+
/// map.insert("z key", vec!["value"]);
1281+
///
1282+
/// let new = vec!["a key", "b key", "z key"];
12811283
///
1282-
/// let new = vec![StrBuf::from_str("a key"),
1283-
/// StrBuf::from_str("b key"),
1284-
/// StrBuf::from_str("z key")];
12851284
/// for k in new.move_iter() {
1286-
/// map.mangle(k, StrBuf::from_str("new value"),
1285+
/// map.mangle(k, "new value",
12871286
/// // if the key doesn't exist in the map yet, add it in
12881287
/// // the obvious way.
12891288
/// |_k, v| vec![v],
@@ -1299,7 +1298,7 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
12991298
/// }
13001299
///
13011300
/// for (k, v) in map.iter() {
1302-
/// println!("{} -> {:?}", *k, *v);
1301+
/// println!("{} -> {}", *k, *v);
13031302
/// }
13041303
/// ```
13051304
pub fn mangle<'a, A>(&'a mut self,

0 commit comments

Comments
 (0)