Skip to content

Commit

Permalink
Don't replace self by empty slice in slice::take
Browse files Browse the repository at this point in the history
  • Loading branch information
timvermeulen committed Nov 6, 2020
1 parent 8dda5c4 commit e35ba52
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3240,8 +3240,7 @@ impl<T> [T] {
if split_index > self.len() {
return None;
}
let original = crate::mem::take(self);
let (front, back) = original.split_at(split_index);
let (front, back) = self.split_at(split_index);
if taking_front {
*self = back;
Some(front)
Expand Down

0 comments on commit e35ba52

Please sign in to comment.