diff options
| author | Pascal Hertleif <killercup@gmail.com> | 2015-05-03 17:44:24 +0200 |
|---|---|---|
| committer | Pascal Hertleif <killercup@gmail.com> | 2015-05-03 17:44:24 +0200 |
| commit | 35149bf1cec8707c186e324bf858f7bb9f2692e8 (patch) | |
| tree | e085d392f8d6b6db7d2c13b3aa43689066626610 /src/libstd | |
| parent | 07915ef6a1426952ba612c02ecafad003bf971a3 (diff) | |
| download | rust-35149bf1cec8707c186e324bf858f7bb9f2692e8.tar.gz rust-35149bf1cec8707c186e324bf858f7bb9f2692e8.zip | |
Clean up HashMap examples
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ec130e8233a..9d0b0dde74f 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -250,26 +250,26 @@ fn test_resize_policy() { /// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot."); /// /// // check for a specific one. -/// if !book_reviews.contains_key(&("Les Misérables")) { +/// if !book_reviews.contains_key("Les Misérables") { /// println!("We've got {} reviews, but Les Misérables ain't one.", /// book_reviews.len()); /// } /// /// // oops, this review has a lot of spelling mistakes, let's delete it. -/// book_reviews.remove(&("The Adventures of Sherlock Holmes")); +/// book_reviews.remove("The Adventures of Sherlock Holmes"); /// /// // look up the values associated with some keys. /// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"]; -/// for book in to_find.iter() { +/// for book in &to_find { /// match book_reviews.get(book) { -/// Some(review) => println!("{}: {}", *book, *review), -/// None => println!("{} is unreviewed.", *book) +/// Some(review) => println!("{}: {}", book, review), +/// None => println!("{} is unreviewed.", book) /// } /// } /// /// // iterate over everything. -/// for (book, review) in book_reviews.iter() { -/// println!("{}: \"{}\"", *book, *review); +/// for (book, review) in &book_reviews { +/// println!("{}: \"{}\"", book, review); /// } /// ``` /// @@ -300,7 +300,7 @@ fn test_resize_policy() { /// vikings.insert(Viking::new("Harald", "Iceland"), 12); /// /// // Use derived implementation to print the status of the vikings. -/// for (viking, health) in vikings.iter() { +/// for (viking, health) in &vikings { /// println!("{:?} has {} hp", viking, health); /// } /// ``` |
