Skip to content

Commit 6a43716

Browse files
committed
Specify only that duplicates are discarded, not the order.
1 parent b5e8a5d commit 6a43716

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

library/alloc/src/collections/btree/map.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2292,7 +2292,7 @@ impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
22922292
/// Constructs a `BTreeMap<K, V>` from an iterator of key-value pairs.
22932293
///
22942294
/// If the iterator produces any pairs with equal keys,
2295-
/// all but the last value for each such key are discarded.
2295+
/// all but one of the corresponding values will be dropped.
22962296
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> BTreeMap<K, V> {
22972297
let mut inputs: Vec<_> = iter.into_iter().collect();
22982298

@@ -2409,8 +2409,8 @@ where
24092409
impl<K: Ord, V, const N: usize> From<[(K, V); N]> for BTreeMap<K, V> {
24102410
/// Converts a `[(K, V); N]` into a `BTreeMap<K, V>`.
24112411
///
2412-
/// If any entries in the array have equal keys, all but the last entry for each such key
2413-
/// are discarded.
2412+
/// If any entries in the array have equal keys,
2413+
/// all but one of the corresponding values will be dropped.
24142414
///
24152415
/// ```
24162416
/// use std::collections::BTreeMap;

library/alloc/src/collections/btree/set.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,8 @@ impl<T: Ord, A: Allocator + Clone> BTreeSet<T, A> {
14911491
impl<T: Ord, const N: usize> From<[T; N]> for BTreeSet<T> {
14921492
/// Converts a `[T; N]` into a `BTreeSet<T>`.
14931493
///
1494-
/// If the array contains any equal values, all but the last instance of each are discarded.
1494+
/// If the array contains any equal values,
1495+
/// all but one will be dropped.
14951496
///
14961497
/// # Examples
14971498
///

library/std/src/collections/hash/map.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1448,8 +1448,8 @@ where
14481448
{
14491449
/// Converts a `[(K, V); N]` into a `HashMap<K, V>`.
14501450
///
1451-
/// If any entries in the array have equal keys, all but the last entry for each such key
1452-
/// are discarded.
1451+
/// If any entries in the array have equal keys,
1452+
/// all but one of the corresponding values will be dropped.
14531453
///
14541454
/// # Examples
14551455
///
@@ -3227,7 +3227,7 @@ where
32273227
/// Constructs a `HashMap<K, V>` from an iterator of key-value pairs.
32283228
///
32293229
/// If the iterator produces any pairs with equal keys,
3230-
/// all but the last value for each such key are discarded.
3230+
/// all but one of the corresponding values will be dropped.
32313231
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> HashMap<K, V, S> {
32323232
let mut map = HashMap::with_hasher(Default::default());
32333233
map.extend(iter);

library/std/src/collections/hash/set.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,8 @@ where
10931093
{
10941094
/// Converts a `[T; N]` into a `HashSet<T>`.
10951095
///
1096-
/// If the array contains any equal values, all but the last instance of each are discarded.
1096+
/// If the array contains any equal values,
1097+
/// all but one will be dropped.
10971098
///
10981099
/// # Examples
10991100
///

0 commit comments

Comments
 (0)