@@ -212,8 +212,9 @@ fn test_resize_policy() {
212
212
/// overridden with one of the constructors.
213
213
///
214
214
/// It is required that the keys implement the `Eq` and `Hash` traits, although
215
- /// this can frequently be achieved by using `#[derive(Eq, Hash)]`. If you
216
- /// implement these yourself, it is important that the following property holds:
215
+ /// this can frequently be achieved by using `#[derive(PartialEq, Eq, Hash)]`.
216
+ /// If you implement these yourself, it is important that the following
217
+ /// property holds:
217
218
///
218
219
/// ```text
219
220
/// k1 == k2 -> hash(k1) == hash(k2)
@@ -250,26 +251,26 @@ fn test_resize_policy() {
250
251
/// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot.");
251
252
///
252
253
/// // check for a specific one.
253
- /// if !book_reviews.contains_key(&( "Les Misérables") ) {
254
+ /// if !book_reviews.contains_key("Les Misérables") {
254
255
/// println!("We've got {} reviews, but Les Misérables ain't one.",
255
256
/// book_reviews.len());
256
257
/// }
257
258
///
258
259
/// // oops, this review has a lot of spelling mistakes, let's delete it.
259
- /// book_reviews.remove(&( "The Adventures of Sherlock Holmes") );
260
+ /// book_reviews.remove("The Adventures of Sherlock Holmes");
260
261
///
261
262
/// // look up the values associated with some keys.
262
263
/// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"];
263
- /// for book in to_find.iter() {
264
+ /// for book in & to_find {
264
265
/// match book_reviews.get(book) {
265
- /// Some(review) => println!("{}: {}", * book, * review),
266
- /// None => println!("{} is unreviewed.", * book)
266
+ /// Some(review) => println!("{}: {}", book, review),
267
+ /// None => println!("{} is unreviewed.", book)
267
268
/// }
268
269
/// }
269
270
///
270
271
/// // iterate over everything.
271
- /// for (book, review) in book_reviews.iter() {
272
- /// println!("{}: \"{}\"", * book, * review);
272
+ /// for (book, review) in & book_reviews {
273
+ /// println!("{}: \"{}\"", book, review);
273
274
/// }
274
275
/// ```
275
276
///
@@ -300,7 +301,7 @@ fn test_resize_policy() {
300
301
/// vikings.insert(Viking::new("Harald", "Iceland"), 12);
301
302
///
302
303
/// // Use derived implementation to print the status of the vikings.
303
- /// for (viking, health) in vikings.iter() {
304
+ /// for (viking, health) in & vikings {
304
305
/// println!("{:?} has {} hp", viking, health);
305
306
/// }
306
307
/// ```
0 commit comments