summary refs log tree commit diff
path: root/src/libstd/collections/hash/set.rs
AgeCommit message (Collapse)AuthorLines
2019-04-03improve worst-case performance of HashSet.is_subsetStein Somers-1/+5
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-10/+10
2019-03-16Rollup merge of #59082 - alexreg:cosmetic-2-doc-comments, r=Centrilkennytm-1/+1
A few improvements to comments in user-facing crates Not too many this time, and all concern comments (almost all doc comments) in user-facing crates (libstd, libcore, liballoc). r? @steveklabnik
2019-03-11Improvements to comments in libstd, libcore, liballoc.Alexander Regueiro-1/+1
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-4/+4
2019-02-28libstd => 2018Taiki Endo-6/+6
2019-02-25Rollup merge of #58370 - nox:relax-bounds, r=dtolnayMazdak Farrokhzad-118/+114
Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S> Notably, hash iterators don't require any trait bounds to be iterated.
2019-02-20Rollup merge of #58553 - scottmcm:more-ihle, r=Centrilkennytm-24/+24
Use more impl header lifetime elision Inspired by seeing explicit lifetimes on these two: - https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator - https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not And a follow-up to https://github.com/rust-lang/rust/pull/54687, that started using IHLE in libcore. Most of the changes in here fall into two big categories: - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm). I also removed two lifetimes that turned out to be completely unused; see https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
2019-02-17Use more impl header lifetime elisionScott McMurray-24/+24
There are two big categories of changes in here - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
2019-02-13Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S>Anthony Ramine-118/+114
Notably, hash iterators don't require any trait bounds to be iterated.
2019-02-10libs: doc commentsAlexander Regueiro-2/+2
2019-01-09Fix poor worst case performance of is_disjointStein Somers-2/+5
2019-01-09Merge remote-tracking branch 'upstream/master'Stein Somers-11/+1
2019-01-03Fix repeated word typosWiktor Kuchta-1/+1
Found with `git grep -P '\b([a-z]+)\s+\1\b'`
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-21Fix poor worst case performance of set intersection (and union, somewhat) on ↵Stein Somers-6/+56
asymmetrically sized sets and extend unit tests slightly beyond that
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-6/+6
2018-12-02Update issue number of `shrink_to` methods to point the tracking issueHidehito Yabuuchi-1/+1
2018-06-18Prefer use of owned values in examplesKornel-12/+12
2018-03-27Implement `shrink_to` method on collectionsDiggory Blake-0/+28
2018-03-06Rollup merge of #47463 - bluss:fused-iterator, r=alexcrichtonkennytm-7/+7
Stabilize FusedIterator FusedIterator is a marker trait that promises that the implementing iterator continues to return `None` from `.next()` once it has returned `None` once (and/or `.next_back()`, if implemented). The effects of FusedIterator are already widely available through `.fuse()`, but with stable `FusedIterator`, stable Rust users can implement this trait for their iterators when appropriate. Closes #35602
2018-03-05Remove a couple of `isize` references from hashmap docsTobias Bucher-2/+2
Also fix a spelling mistake.
2018-03-03core: Update stability attributes for FusedIteratorUlrik Sverdrup-7/+7
2018-03-03core: Stabilize FusedIteratorUlrik Sverdrup-7/+7
FusedIterator is a marker trait that promises that the implementing iterator continues to return `None` from `.next()` once it has returned `None` once (and/or `.next_back()`, if implemented). The effects of FusedIterator are already widely available through `.fuse()`, but with stable `FusedIterator`, stable Rust users can implement this trait for their iterators when appropriate.
2018-01-05Write examples for {BTree,Hash}Set::{get,replace,take}Stjepan Glavina-0/+33
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-14/+6
2017-09-15HashMap::new and HashSet::new do not allocateJon Gjengset-0/+3
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2017-08-01Add doc example for HashSet::drain.Corey Farwell-0/+16
2017-08-01Remove unnecessary clones in doc examples.Corey Farwell-11/+11
2017-08-01Show the capacity in HashSet::with_capacity doc example.Corey Farwell-0/+1
2017-08-01Remove unnecessary 'mut' bindings.Corey Farwell-2/+2
2017-08-01Indicate HashSet is code-like in docs.Corey Farwell-1/+1
2017-08-01Show that the capacity changed in HashSet::reserve doc example.Corey Farwell-0/+1
2017-08-01Add doc example for HashSet::hasher.Corey Farwell-0/+11
2017-05-20Stabilize library features for 1.18.0Steven Fackler-32/+21
Closes #38863 Closes #38980 Closes #38903 Closes #36648
2017-04-22Fix invalid linkageGuillaume Gomez-1/+1
2017-04-13Various consistency and phrasing fixes in std::collections' docslukaramu-2/+1
* Changed btree_map's and hash_map's Entry (etc.) docs to be consistent * Changed VecDeque's type and module summary sentences to be consistent with each other as well as with other summary sentences in the module * Changed HashMap's and HashSet's summary sentences to be less redundantly phrased and also more consistant with the other summary sentences in the module * Also, added an example to Bound
2017-04-13Various fixes throughout std::collections' docslukaramu-20/+41
* Added links where possible (limited because of facading) * Changed references to methods from `foo()` to `foo` in module docs * Changed references to methods from `HashMap::foo` to just `foo` in top-level docs for `HashMap` and the `default` doc for `DefaultHasher` * Various small other fixes
2017-04-13Update std::collections' docs to use iterator (etc.) boilerplatelukaramu-7/+49
This greatly improves consistency.
2017-02-15Auto merge of #39560 - F001:retainHashMap, r=alexcrichtonbors-0/+33
std: Add retain method for HashMap and HashSet Fix #36648 r? @bluss
2017-02-09Update set operations documentationJethro Beekman-7/+13
Reminding people of set terminology.
2017-02-08std: Add retain method for HashMap and HashSetf001-0/+33
Fix #36648
2017-01-29Fix a few impl stability attributesOliver Middleton-7/+7
The versions show up in rustdoc.
2016-12-18Implement `fmt::Debug` for all structures in libstd.Corey Farwell-0/+77
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-12-06Smarter HashMap/HashSet extendarthurprs-7/+3
2016-10-06Auto merge of #36753 - srinivasreddy:hash, r=nrcbors-76/+159
run rustfmt on libstd/collections/hash folder
2016-10-03Auto merge of #36766 - nnethercote:hash-span-capacity, r=blussbors-5/+28
Clarify HashMap's capacity handling. HashMap has two notions of "capacity": - "Usable capacity": the number of elements a hash map can hold without resizing. This is the meaning of "capacity" used in HashMap's API, e.g. the `with_capacity()` function. - "Internal capacity": the number of allocated slots. Except for the zero case, it is always larger than the usable capacity (because some slots must be left empty) and is always a power of two. HashMap's code is confusing because it does a poor job of distinguishing these two meanings. I propose using two different terms for these two concepts. Because "capacity" is already used in HashMap's API to mean "usable capacity", I will use a different word for "internal capacity". I propose "span", though I'm happy to consider other names.
2016-09-29Clarify HashMap's capacity handling.Nicholas Nethercote-5/+28
This commit does the following. - Changes the terminology for capacities used within HashMap's code. "Internal capacity" is now consistently "raw capacity", and "usable capacity" is now consistently just "capacity". This makes the code easier to understand. - Reworks capacity and raw capacity computations. Raw capacity computations are now handled in a single place: `DefaultResizePolicy::raw_capacity()`. This function correctly returns zero when given zero, which means that the following cases now result in a capacity of zero when they previously did not. * `Hash{Map,Set}::with_capacity(0)` * `Hash{Map,Set}::with_capacity_and_hasher(0)` * `Hash{Map,Set}::shrink_to_fit()`, when used with a hash map/set whose elements have all been removed - Strengthens the language used in the comments describing the above functions, to make it clearer when they will result in a map/set with a capacity of zero. The new language is based on the language used for the corresponding functions in `Vec`. - Adds tests for the above zero-capacity cases. - Removes `test_resize_policy` because it is no longer useful.
2016-09-28Rollup merge of #36740 - frehberg:apidoc, r=steveklabnikJonathan Turner-0/+14
Document init of HashSet/HashMap from vector