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> {
18591859 // Guarantees there is space in `self` for `other`.
18601860 self . reserve ( src_total) ;
18611861
1862- let new_head = {
1862+ self . head = {
18631863 let original_head = self . head ;
18641864
18651865 // The goal is to copy all values from `other` into `self`. To avoid any
@@ -1988,12 +1988,8 @@ impl<T> VecDeque<T> {
19881988 }
19891989 } ;
19901990
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 ;
19971993 }
19981994
19991995 /// Retains only the elements specified by the predicate.
You can’t perform that action at this time.
0 commit comments