try different method

legacy
Avril 4 years ago
parent e6f979942d
commit 733970c55b
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -94,10 +94,15 @@ impl<T> VecExt<T> for Vec<T>
(0, Some(0)) | (0, None) => (), (0, Some(0)) | (0, None) => (),
(_, Some(bound)) | (bound, _) => self.reserve(bound), (_, 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 // shift everything across, replacing with the new values
let splice: Vec<_> = self.splice(location.., slice).collect(); 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 // add tail back
self.extend(splice); self.extend(splice);*/
} }
} }

Loading…
Cancel
Save