Skip to content

Commit 35149bf

Browse files
committed
Clean up HashMap examples
1 parent 07915ef commit 35149bf

File tree

1 file changed

+8
-8
lines changed
  • src/libstd/collections/hash

1 file changed

+8
-8
lines changed

src/libstd/collections/hash/map.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,26 +250,26 @@ fn test_resize_policy() {
250250
/// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot.");
251251
///
252252
/// // check for a specific one.
253-
/// if !book_reviews.contains_key(&("Les Misérables")) {
253+
/// if !book_reviews.contains_key("Les Misérables") {
254254
/// println!("We've got {} reviews, but Les Misérables ain't one.",
255255
/// book_reviews.len());
256256
/// }
257257
///
258258
/// // oops, this review has a lot of spelling mistakes, let's delete it.
259-
/// book_reviews.remove(&("The Adventures of Sherlock Holmes"));
259+
/// book_reviews.remove("The Adventures of Sherlock Holmes");
260260
///
261261
/// // look up the values associated with some keys.
262262
/// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"];
263-
/// for book in to_find.iter() {
263+
/// for book in &to_find {
264264
/// match book_reviews.get(book) {
265-
/// Some(review) => println!("{}: {}", *book, *review),
266-
/// None => println!("{} is unreviewed.", *book)
265+
/// Some(review) => println!("{}: {}", book, review),
266+
/// None => println!("{} is unreviewed.", book)
267267
/// }
268268
/// }
269269
///
270270
/// // iterate over everything.
271-
/// for (book, review) in book_reviews.iter() {
272-
/// println!("{}: \"{}\"", *book, *review);
271+
/// for (book, review) in &book_reviews {
272+
/// println!("{}: \"{}\"", book, review);
273273
/// }
274274
/// ```
275275
///
@@ -300,7 +300,7 @@ fn test_resize_policy() {
300300
/// vikings.insert(Viking::new("Harald", "Iceland"), 12);
301301
///
302302
/// // Use derived implementation to print the status of the vikings.
303-
/// for (viking, health) in vikings.iter() {
303+
/// for (viking, health) in &vikings {
304304
/// println!("{:?} has {} hp", viking, health);
305305
/// }
306306
/// ```

0 commit comments

Comments
 (0)