]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #91482 - JosephTLyons:update-HashMap-and-BTreeMap-documentation,...
authorMatthias Krüger <matthias.krueger@famsik.de>
Fri, 10 Dec 2021 21:40:33 +0000 (22:40 +0100)
committerGitHub <noreply@github.com>
Fri, 10 Dec 2021 21:40:33 +0000 (22:40 +0100)
commit5510803fe98660d96e9b6b9ba95cc00b8539155f
tree6ec15978f6a0181cefeaba3d31ca4d9bd09a1aee
parentb7b4d7742e42d821acf15663ca3c0285cc20fa76
parent72a6974e455793f9dcc370cc8bdf9c055b843d39
Rollup merge of #91482 - JosephTLyons:update-HashMap-and-BTreeMap-documentation, r=yaahc

Update documentation to use `from()` to initialize `HashMap`s and `BTreeMap`s

As of Rust 1.56, `HashMap` and `BTreeMap` both have associated `from()` functions.  I think using these in the documentation cleans things up a bit.  It allows us to remove some of the `mut`s and avoids the Initialize-Then-Modify anti-pattern.
library/alloc/src/collections/btree/map.rs
library/std/src/collections/hash/map.rs