rustup; add swap_remove test

This commit is contained in:
Ralf Jung 2021-10-21 09:49:19 -04:00
parent 24a1d78a70
commit a6b12c229b
2 changed files with 10 additions and 1 deletions

View File

@ -1 +1 @@
81117ff930fbf3792b4f9504e3c6bccc87b10823
e015ef5b2633960e7653b744d7a1c3d1d336313a

View File

@ -140,6 +140,14 @@ fn swap() {
v.swap(2, 2);
}
fn swap_remove() {
let mut a = 0;
let mut b = 1;
let mut vec = vec![&mut a, &mut b];
vec.swap_remove(1);
}
fn main() {
assert_eq!(vec_reallocate().len(), 5);
@ -167,4 +175,5 @@ fn main() {
sort();
swap();
swap_remove();
}