Skip to content

Commit 908979d

Browse files
committed
Auto merge of #29299 - tbu-:pr_btreemap_example_dup, r=alexcrichton
2 parents c3db627 + 4b45f39 commit 908979d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libstd/collections/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@
332332
//! ```
333333
//! use std::collections::btree_map::BTreeMap;
334334
//!
335-
//! // A client of the bar. They have an id and a blood alcohol level.
336-
//! struct Person { id: u32, blood_alcohol: f32 }
335+
//! // A client of the bar. They have a blood alcohol level.
336+
//! struct Person { blood_alcohol: f32 }
337337
//!
338338
//! // All the orders made to the bar, by client id.
339339
//! let orders = vec![1,2,1,2,3,4,1,2,2,3,4,1,1,1];
@@ -344,15 +344,15 @@
344344
//! for id in orders {
345345
//! // If this is the first time we've seen this customer, initialize them
346346
//! // with no blood alcohol. Otherwise, just retrieve them.
347-
//! let person = blood_alcohol.entry(id).or_insert(Person{id: id, blood_alcohol: 0.0});
347+
//! let person = blood_alcohol.entry(id).or_insert(Person { blood_alcohol: 0.0 });
348348
//!
349349
//! // Reduce their blood alcohol level. It takes time to order and drink a beer!
350350
//! person.blood_alcohol *= 0.9;
351351
//!
352352
//! // Check if they're sober enough to have another beer.
353353
//! if person.blood_alcohol > 0.3 {
354354
//! // Too drunk... for now.
355-
//! println!("Sorry {}, I have to cut you off", person.id);
355+
//! println!("Sorry {}, I have to cut you off", id);
356356
//! } else {
357357
//! // Have another!
358358
//! person.blood_alcohol += 0.1;

0 commit comments

Comments
 (0)