From 733970c55bccb0679a044a91e3904d4350f205cf Mon Sep 17 00:00:00 2001 From: Avril Date: Sun, 13 Sep 2020 09:25:13 +0100 Subject: [PATCH] try different method --- src/ext.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ext.rs b/src/ext.rs index 011c652..8a9e4ed 100644 --- a/src/ext.rs +++ b/src/ext.rs @@ -94,10 +94,15 @@ impl VecExt for Vec (0, Some(0)) | (0, None) => (), (_, Some(bound)) | (bound, _) => self.reserve(bound), }; + + let splice = self.split_off(location); + self.extend(slice.chain(splice.into_iter())); + /* // shift everything across, replacing with the new values let splice: Vec<_> = self.splice(location.., slice).collect(); + // ^ -- this allocation bugs me, but we violate aliasing rules if we don't somehow collect it before adding it back in so... // add tail back - self.extend(splice); + self.extend(splice);*/ } }