File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -1859,7 +1859,7 @@ impl<T> VecDeque<T> {
1859
1859
// Guarantees there is space in `self` for `other`.
1860
1860
self . reserve ( src_total) ;
1861
1861
1862
- let new_head = {
1862
+ self . head = {
1863
1863
let original_head = self . head ;
1864
1864
1865
1865
// The goal is to copy all values from `other` into `self`. To avoid any
@@ -1988,12 +1988,8 @@ impl<T> VecDeque<T> {
1988
1988
}
1989
1989
} ;
1990
1990
1991
- // Up until this point we are in a bad state as some values
1992
- // exist in both `self` and `other`. To preserve panic safety
1993
- // it is important we clear the old values from `other`...
1994
- other. clear ( ) ;
1995
- // and that we update `head` as the last step, making the values accessible in `self`.
1996
- self . head = new_head;
1991
+ // Some values now exist in both `other` and `self` but are made inaccessible in `other`.
1992
+ other. tail = other. head ;
1997
1993
}
1998
1994
1999
1995
/// Retains only the elements specified by the predicate.
You can’t perform that action at this time.
0 commit comments