Skip to content

Commit

Permalink
Use set_len
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Apr 1, 2019
1 parent 30e7e9c commit e8b3aea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl<T> TypedArena<T> {
let len = vec.len();
let start_ptr = self.alloc_raw_slice(len);
vec.as_ptr().copy_to_nonoverlapping(start_ptr, len);
mem::forget(vec.drain());
vev.set_len(0);
slice::from_raw_parts_mut(start_ptr, len)
}
})
Expand Down Expand Up @@ -515,7 +515,7 @@ impl DroplessArena {
mem::align_of::<T>()
) as *mut _ as *mut T;
vec.as_ptr().copy_to_nonoverlapping(start_ptr, len);
mem::forget(vec.drain());
vev.set_len(0);
slice::from_raw_parts_mut(start_ptr, len)
}
})
Expand Down

0 comments on commit e8b3aea

Please sign in to comment.