diff options
| author | Jon Gjengset <jon@thesquareplanet.com> | 2017-09-15 13:32:45 -0400 |
|---|---|---|
| committer | Jon Gjengset <jon@thesquareplanet.com> | 2017-09-15 13:32:56 -0400 |
| commit | f7e974e4322b53cdadddf2ca8c72eaf419d406f2 (patch) | |
| tree | d871e16676ef627c582368e167cddaa722d24120 /src/libstd/collections/hash/map.rs | |
| parent | fd4bef54abafe6d93ec3c87498de696da6ef5819 (diff) | |
| download | rust-f7e974e4322b53cdadddf2ca8c72eaf419d406f2.tar.gz rust-f7e974e4322b53cdadddf2ca8c72eaf419d406f2.zip | |
HashMap::new and HashSet::new do not allocate
Diffstat (limited to 'src/libstd/collections/hash/map.rs')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index fbb69ca9749..96af2272578 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -588,6 +588,9 @@ impl<K, V, S> HashMap<K, V, S> impl<K: Hash + Eq, V> HashMap<K, V, RandomState> { /// Creates an empty `HashMap`. /// + /// The hash map is initially created with a capacity of 0, so it will not allocate until it + /// is first inserted into. + /// /// # Examples /// /// ``` |
