about summary refs log tree commit diff
path: root/src/libstd/collections
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-12-28 06:52:15 +0000
committerbors <bors@rust-lang.org>2018-12-28 06:52:15 +0000
commitee49bf8964492ad22f530cbcadcafc6704ec44c3 (patch)
treea0ce7dd6363ddd204cc58731aed97471330e5d1e /src/libstd/collections
parente8ca35e63dda82a8b5fa8eb72cf3e490a5794a46 (diff)
parentadfc0667bc0e452aed0f5e65452c00f775b48ef4 (diff)
downloadrust-ee49bf8964492ad22f530cbcadcafc6704ec44c3.tar.gz
rust-ee49bf8964492ad22f530cbcadcafc6704ec44c3.zip
Auto merge of #55519 - fhartwig:hashmap-index-example, r=Centril
Add example of using the indexing operator to HashMap docs

Fixes #52575
Diffstat (limited to 'src/libstd/collections')
-rw-r--r--src/libstd/collections/hash/map.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 86a8e0f5baf..91c4e990e00 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -309,6 +309,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);