Skip to content

Commit 914b855

Browse files
committed
Fix comments outdated during rust-lang#66648
1 parent 116dff9 commit 914b855

File tree

1 file changed

+4
-5
lines changed
  • src/liballoc/collections/btree

1 file changed

+4
-5
lines changed

src/liballoc/collections/btree/map.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl<K: Clone, V: Clone> BTreeClone for BTreeMap<K, V> {
227227
impl<K: Clone + Ord, V: Clone> BTreeClone for BTreeMap<K, V> {
228228
fn clone_from(&mut self, other: &Self) {
229229
// This truncates `self` to `other.len()` by calling `split_off` on
230-
// the first key after `other.len()` elements if it exists
230+
// the first key after `other.len()` elements if it exists.
231231
let split_off_key = if self.len() > other.len() {
232232
let diff = self.len() - other.len();
233233
if diff <= other.len() {
@@ -247,19 +247,18 @@ impl<K: Clone + Ord, V: Clone> BTreeClone for BTreeMap<K, V> {
247247
// After truncation, `self` is at most as long as `other` so this loop
248248
// replaces every key-value pair in `self`. Since `oiter` is in sorted
249249
// order and the structure of the `BTreeMap` stays the same,
250-
// the BTree invariants are maintained at the end of the loop
250+
// the BTree invariants are maintained at the end of the loop.
251251
while !siter.is_empty() {
252252
if let Some((ok, ov)) = oiter.next() {
253-
// SAFETY: This is safe because the `siter.front != siter.back` check
254-
// ensures that `siter` is nonempty
253+
// SAFETY: This is safe because `siter` is nonempty.
255254
let (sk, sv) = unsafe { siter.next_unchecked() };
256255
sk.clone_from(ok);
257256
sv.clone_from(ov);
258257
} else {
259258
break;
260259
}
261260
}
262-
// If `other` is longer than `self`, the remaining elements are inserted
261+
// If `other` is longer than `self`, the remaining elements are inserted.
263262
self.extend(oiter.map(|(k, v)| ((*k).clone(), (*v).clone())));
264263
}
265264
}

0 commit comments

Comments
 (0)