| Age | Commit message (Collapse) | Author | Lines |
|
Make it consistent in this regard with `BTreeMap`'s.
Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
|
|
Take the one from `BTreeMap` that seems the best-worded and most
precise among the available variations.
Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
|
|
Also fixes `HashSet`'s that incorrectly designated itself as a `list`.
Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
|
|
A minor change, but it seemed interesting to unify this one's
description, especially considering all the other equivalents use
`element` as well.
Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
|
|
|
|
|
|
std: Add performance warnings to HashMap::get_disjoint_mut
Closes #139296
The `get_disjoint_mut` in `HashMap` also performs a complexity O(n^2) check. So we need to be reminded of that as well.
https://github.com/rust-lang/hashbrown/blob/b5b0655a37e156f9798ac8dd7e970d4adba9bf90/src/raw/mod.rs#L1216-L1220
|
|
Co-authored-by: Jonas Böttiger <jonasboettiger@icloud.com>
|
|
|
|
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
|
|
Improve HashMap docs for const and static initializers
Closes #137566.
I clarified the HashMap usage in const and static initializers.
I also added examples of how to construct such HashMaps wrapped in LazyLock.
|
|
|
|
|
|
Stabilize `hash_extract_if`
FCP complete: https://github.com/rust-lang/rust/issues/59618#issuecomment-2674880530
Tracking issue: #59618
Closes #59618
|
|
(cherry picked from commit e4840ce59bdddb19394df008c5c26d9c493725f8)
|
|
|
|
as well as `HashMap::get_many_unchecked_mut` to
`HashMap::get_disjoint_unchecked_mut`.
|
|
|
|
|
|
|
|
|
|
This behavior is worth documenting because there are other plausible
alternatives, such as panicking when a duplicate is encountered, and
it reminds the programmer to consider whether they should, for example,
coalesce duplicate keys first.
|
|
|
|
|
|
|
|
They are unusual methods. The docs don't really describe the cases when
they might be useful (as opposed to just `get`), and the examples don't
demonstrate the interesting cases at all.
This commit improves the docs and the examples.
|
|
Add Set entry API
See https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/HashSet.3A.3Aentry/near/413224639 and https://github.com/rust-lang/rust/issues/60896#issuecomment-678708111
Closes https://github.com/rust-lang/rfcs/issues/1490
|
|
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
|
|
|
|
|
|
(cherry picked from commit 567fd9610cbfd220844443487059335d7e1ff021)
|
|
|
|
as well as removing some from std as they no longer
exists in Hashbrown it-self.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Page affected: https://doc.rust-lang.org/std/collections/index.html#performance
Changes:
- bulleted conventions
- expanded definitions on terms used
- more accessible language
- merged Sequence and Map performance cost tables
|
|
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
|
|
|
|
This provides a list of locations to hunt down issues in.
|
|
|
|
Document overrides of `clone_from()` in core/std
As mentioned in https://github.com/rust-lang/rust/pull/96979#discussion_r1379502413
Specifically, when an override doesn't just forward to an inner type, document the behavior and that it's preferred over simply assigning a clone of source. Also, change instances where the second parameter is "other" to "source".
I reused some of the wording over and over for similar impls, but I'm not sure that the wording is actually *good*. Would appreciate feedback about that.
Also, now some of these seem to provide pretty specific guarantees about behavior (e.g. will reuse the exact same allocation iff the len is the same), but I was basing it off of the docs for [`Box::clone_from`](https://doc.rust-lang.org/1.75.0/std/boxed/struct.Box.html#method.clone_from-1) - I'm not sure if providing those strong guarantees is actually good or not.
|
|
|
|
Specifically, when an override doesn't just forward to an inner type,
document the behavior and that it's preferred over simply assigning
a clone of source. Also, change instances where the second parameter is
"other" to "source".
|
|
Help with common API confusion, like asking for `push` when the data structure really has `append`.
```
error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope
--> $DIR/rustc_confusables_std_cases.rs:17:7
|
LL | x.size();
| ^^^^
|
help: you might have meant to use `len`
|
LL | x.len();
| ~~~
help: there is a method with a similar name
|
LL | x.resize();
| ~~~~~~
```
#59450
|
|
|