From 10138ad89020a51036fc0fe89c004e18530511cf Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Wed, 13 Jan 2021 18:57:03 -0500 Subject: [PATCH] Swap each element instead of calling rotate_left --- src/arrayvec.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/arrayvec.rs b/src/arrayvec.rs index 80b4356..bffd35e 100644 --- a/src/arrayvec.rs +++ b/src/arrayvec.rs @@ -601,7 +601,9 @@ impl ArrayVec { pub fn remove(&mut self, index: usize) -> A::Item { let targets: &mut [A::Item] = &mut self.deref_mut()[index..]; let item = take(&mut targets[0]); - targets.rotate_left(1); + for i in 0..targets.len() - 1 { + targets.swap(i, i + 1); + } self.len -= 1; item }