diff options
| author | bors <bors@rust-lang.org> | 2015-10-26 02:56:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-10-26 02:56:27 +0000 |
| commit | 908979d53d9261de7bb87708762c099fb069840c (patch) | |
| tree | 09721b0f87baa290ccb65fc605913ecffd3bc263 /src/libstd | |
| parent | c3db627cbf354ba02311fb0c523e365e8d017b00 (diff) | |
| parent | 4b45f39f92ce9f525e96564d8e587c62b18c709c (diff) | |
| download | rust-908979d53d9261de7bb87708762c099fb069840c.tar.gz rust-908979d53d9261de7bb87708762c099fb069840c.zip | |
Auto merge of #29299 - tbu-:pr_btreemap_example_dup, r=alexcrichton
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs index 77f571d580b..71d9fbfaa3e 100644 --- a/src/libstd/collections/mod.rs +++ b/src/libstd/collections/mod.rs @@ -332,8 +332,8 @@ //! ``` //! use std::collections::btree_map::BTreeMap; //! -//! // A client of the bar. They have an id and a blood alcohol level. -//! struct Person { id: u32, blood_alcohol: f32 } +//! // A client of the bar. They have a blood alcohol level. +//! struct Person { blood_alcohol: f32 } //! //! // All the orders made to the bar, by client id. //! let orders = vec![1,2,1,2,3,4,1,2,2,3,4,1,1,1]; @@ -344,7 +344,7 @@ //! for id in orders { //! // If this is the first time we've seen this customer, initialize them //! // with no blood alcohol. Otherwise, just retrieve them. -//! let person = blood_alcohol.entry(id).or_insert(Person{id: id, blood_alcohol: 0.0}); +//! let person = blood_alcohol.entry(id).or_insert(Person { blood_alcohol: 0.0 }); //! //! // Reduce their blood alcohol level. It takes time to order and drink a beer! //! person.blood_alcohol *= 0.9; @@ -352,7 +352,7 @@ //! // Check if they're sober enough to have another beer. //! if person.blood_alcohol > 0.3 { //! // Too drunk... for now. -//! println!("Sorry {}, I have to cut you off", person.id); +//! println!("Sorry {}, I have to cut you off", id); //! } else { //! // Have another! //! person.blood_alcohol += 0.1; |
