diff options
| author | Stein Somers <git@steinsomers.be> | 2020-02-02 20:30:52 +0100 |
|---|---|---|
| committer | Stein Somers <git@steinsomers.be> | 2020-02-16 22:10:14 +0100 |
| commit | 914b855f40c10f1db627bef5543e5c2edfe50b14 (patch) | |
| tree | 283760b4bde1c785b5fa40b7a5acb4cdf261b077 /src/liballoc | |
| parent | 116dff95a37214e86f067715374a18a4de1621f0 (diff) | |
| download | rust-914b855f40c10f1db627bef5543e5c2edfe50b14.tar.gz rust-914b855f40c10f1db627bef5543e5c2edfe50b14.zip | |
Fix comments outdated during #66648
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/collections/btree/map.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index 5b4b1c93347..74069bbf8a3 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -227,7 +227,7 @@ impl<K: Clone, V: Clone> BTreeClone for BTreeMap<K, V> { impl<K: Clone + Ord, V: Clone> BTreeClone for BTreeMap<K, V> { fn clone_from(&mut self, other: &Self) { // This truncates `self` to `other.len()` by calling `split_off` on - // the first key after `other.len()` elements if it exists + // the first key after `other.len()` elements if it exists. let split_off_key = if self.len() > other.len() { let diff = self.len() - other.len(); if diff <= other.len() { @@ -247,11 +247,10 @@ impl<K: Clone + Ord, V: Clone> BTreeClone for BTreeMap<K, V> { // After truncation, `self` is at most as long as `other` so this loop // replaces every key-value pair in `self`. Since `oiter` is in sorted // order and the structure of the `BTreeMap` stays the same, - // the BTree invariants are maintained at the end of the loop + // the BTree invariants are maintained at the end of the loop. while !siter.is_empty() { if let Some((ok, ov)) = oiter.next() { - // SAFETY: This is safe because the `siter.front != siter.back` check - // ensures that `siter` is nonempty + // SAFETY: This is safe because `siter` is nonempty. let (sk, sv) = unsafe { siter.next_unchecked() }; sk.clone_from(ok); sv.clone_from(ov); @@ -259,7 +258,7 @@ impl<K: Clone + Ord, V: Clone> BTreeClone for BTreeMap<K, V> { break; } } - // If `other` is longer than `self`, the remaining elements are inserted + // If `other` is longer than `self`, the remaining elements are inserted. self.extend(oiter.map(|(k, v)| ((*k).clone(), (*v).clone()))); } } |
