@@ -227,7 +227,7 @@ impl<K: Clone, V: Clone> BTreeClone for BTreeMap<K, V> {
227
227
impl < K : Clone + Ord , V : Clone > BTreeClone for BTreeMap < K , V > {
228
228
fn clone_from ( & mut self , other : & Self ) {
229
229
// 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.
231
231
let split_off_key = if self . len ( ) > other. len ( ) {
232
232
let diff = self . len ( ) - other. len ( ) ;
233
233
if diff <= other. len ( ) {
@@ -247,19 +247,18 @@ impl<K: Clone + Ord, V: Clone> BTreeClone for BTreeMap<K, V> {
247
247
// After truncation, `self` is at most as long as `other` so this loop
248
248
// replaces every key-value pair in `self`. Since `oiter` is in sorted
249
249
// 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.
251
251
while !siter. is_empty ( ) {
252
252
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.
255
254
let ( sk, sv) = unsafe { siter. next_unchecked ( ) } ;
256
255
sk. clone_from ( ok) ;
257
256
sv. clone_from ( ov) ;
258
257
} else {
259
258
break ;
260
259
}
261
260
}
262
- // If `other` is longer than `self`, the remaining elements are inserted
261
+ // If `other` is longer than `self`, the remaining elements are inserted.
263
262
self . extend ( oiter. map ( |( k, v) | ( ( * k) . clone ( ) , ( * v) . clone ( ) ) ) ) ;
264
263
}
265
264
}
0 commit comments