mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 18:40:57 +03:00
Slightly refactor VecDeque implementation
This commit is contained in:
@@ -1024,7 +1024,7 @@ pub fn drain<R>(&mut self, range: R) -> Drain<T>
|
||||
iter: Iter {
|
||||
tail: drain_tail,
|
||||
head: drain_head,
|
||||
ring: unsafe { self.buffer_as_mut_slice() },
|
||||
ring: unsafe { self.buffer_as_slice() },
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -2593,8 +2593,8 @@ fn from(other: VecDeque<T>) -> Self {
|
||||
let mut right_offset = 0;
|
||||
for i in left_edge..right_edge {
|
||||
right_offset = (i - left_edge) % (cap - right_edge);
|
||||
let src: isize = (right_edge + right_offset) as isize;
|
||||
ptr::swap(buf.add(i), buf.offset(src));
|
||||
let src = right_edge + right_offset;
|
||||
ptr::swap(buf.add(i), buf.add(src));
|
||||
}
|
||||
let n_ops = right_edge - left_edge;
|
||||
left_edge += n_ops;
|
||||
|
||||
Reference in New Issue
Block a user