Lokathor / tinyvec

Just, really the littlest Vec you could need. So smol.
https://docs.rs/tinyvec
Apache License 2.0
648 stars 49 forks source link

Fix TODO items #166

Open 8573 opened 2 years ago

8573 commented 2 years ago

Implement two things that were tracked in TODO comments, although only one appears to be in live code: using core::mem::take rather than a reimplementation of it when Rust 1.40 is available.

I changed the #[inline(always)] on the reimplemented take to #[inline] to match what core has, figuring that core would know best what level of inlining hint it should have. On the other hand, do tinyvec's benchmarks indicate that #[inline(always)] helps? If so, I suppose reimplementing the function in all cases may be preferred, in which case this patch would be unnecessary.

This patch, as it is currently written, depends on #165 and is marked as a draft to prevent it from being accidentally merged before #165. If you merge #165, feel free to merge this too regardless of its "draft" state. If you want this patch but not #165, it should not be difficult to rewrite this patch for that case instead.