about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrennan Vincent <brennan@umanwizard.com>2022-01-11 12:08:46 -0700
committerBrennan Vincent <brennan@umanwizard.com>2022-01-11 12:08:46 -0700
commit65d47347ada25ddb45358ec7af07f378f60aa00d (patch)
treef43e7a386c20784681d7acd8ccd959842425016d
parent9057a6d66a9e3a1929a43460e7b0230dc6b6fbda (diff)
downloadrust-65d47347ada25ddb45358ec7af07f378f60aa00d.tar.gz
rust-65d47347ada25ddb45358ec7af07f378f60aa00d.zip
Address review comments
-rw-r--r--library/alloc/src/collections/btree/map.rs4
-rw-r--r--library/alloc/src/collections/btree/set.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index 9e4c22c3f45..b38c5848b49 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -65,8 +65,8 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
 /// incorrect results, aborts, memory leaks, or non-termination) but will not be undefined
 /// behavior.
 ///
-/// Entries in a `BTreeMap` are stored in ascending order according to the [`Ord`] implementation on the key.
-/// Thus, iteration methods are guaranteed to produce iterators that yield items in that order.
+/// Iterators yielded by functions such as [`BTreeMap::iter`], [`BTreeMap::values`], or [`BTreeMap::keys`]
+/// yield their items in order by key, and take worst-case logarithmic and amortized constant time per item yielded.
 ///
 /// [B-Tree]: https://en.wikipedia.org/wiki/B-tree
 /// [`Cell`]: core::cell::Cell
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index c2bf63b4a41..b32f5399588 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -27,8 +27,8 @@ use super::Recover;
 /// incorrect results, aborts, memory leaks, or non-termination) but will not be undefined
 /// behavior.
 ///
-/// Entries in a `BTreeSet` are stored in ascending order according to the [`Ord`] implementation on the key.
-/// Thus, iteration methods are guaranteed to produce iterators that yield items in that order.
+/// Iterators returned by [`BTreeSet::iter`] yield their items in order,
+/// and take worst-case logarithmic and amortized constant time per item yielded.
 ///
 /// [`Ord`]: core::cmp::Ord
 /// [`Cell`]: core::cell::Cell