From 51fdc2bf1431d6ac1f32531f820a937ddbb70048 Mon Sep 17 00:00:00 2001 From: Florian Hartwig Date: Tue, 30 Oct 2018 23:27:05 +0100 Subject: [PATCH 1/4] Add example of using the indexing operator to HashMap docs --- src/libstd/collections/hash/map.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ef5dae724b247..2bc440a19fb08 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -318,6 +318,9 @@ const DISPLACEMENT_THRESHOLD: usize = 128; /// } /// } /// +/// // Look up the value for a key (will panic if the key is not found). +/// println!("Review for Jane: {}", book_reviews["Pride and Prejudice"]); +/// /// // Iterate over everything. /// for (book, review) in &book_reviews { /// println!("{}: \"{}\"", book, review); From 4bddb763c5982bcce93b1683d4e26dbbc92a5ea6 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Tue, 4 Dec 2018 11:49:39 -0800 Subject: [PATCH 2/4] Add example of using the indexing operator to BTreeMap docs --- src/liballoc/collections/btree/map.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index 24c8fd3a969ca..0441b180afba5 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -97,6 +97,9 @@ use self::Entry::*; /// } /// } /// +/// // Look up the value for a key (will panic if the key is not found). +/// println!("Review for Jane: {}", book_reviews["Pride and Prejudice"]); +/// /// // iterate over everything. /// for (movie, review) in &movie_reviews { /// println!("{}: \"{}\"", movie, review); From 439ecf94e56ec94b81b678554a0192cc7e3f3a19 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Wed, 5 Dec 2018 08:25:24 -0800 Subject: [PATCH 3/4] Fix typo in variable name --- src/liballoc/collections/btree/map.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index 0441b180afba5..a7d40f8776fb5 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -98,7 +98,7 @@ use self::Entry::*; /// } /// /// // Look up the value for a key (will panic if the key is not found). -/// println!("Review for Jane: {}", book_reviews["Pride and Prejudice"]); +/// println!("Review for Jane: {}", movie_reviews["Pride and Prejudice"]); /// /// // iterate over everything. /// for (movie, review) in &movie_reviews { From adfc0667bc0e452aed0f5e65452c00f775b48ef4 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Fri, 7 Dec 2018 14:30:01 -0800 Subject: [PATCH 4/4] Fix broken doc test --- src/liballoc/collections/btree/map.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index a7d40f8776fb5..952f36c0ed4b3 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -98,7 +98,7 @@ use self::Entry::*; /// } /// /// // Look up the value for a key (will panic if the key is not found). -/// println!("Review for Jane: {}", movie_reviews["Pride and Prejudice"]); +/// println!("Movie review: {}", movie_reviews["Office Space"]); /// /// // iterate over everything. /// for (movie, review) in &movie_reviews {