From aee0d00899772c09ddf5c22c2e354653c84fcfb8 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 5 Oct 2026 14:24:38 +0200 Subject: [PATCH 1/9] feat: allocator extension for splice --- src/iterators/splice/allocref.rs | 32 ++++++++++++++++++++++ src/iterators/{splice.rs => splice/mod.rs} | 26 ++++++++++-------- 2 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 src/iterators/splice/allocref.rs rename src/iterators/{splice.rs => splice/mod.rs} (88%) diff --git a/src/iterators/splice/allocref.rs b/src/iterators/splice/allocref.rs new file mode 100644 index 00000000..a61e22b6 --- /dev/null +++ b/src/iterators/splice/allocref.rs @@ -0,0 +1,32 @@ +use { + super::Allocator, + core::{ + alloc::Layout, + ptr::NonNull + } +}; + +pub struct Allocref<'valid, Heap: Allocator>(pub &'valid Heap); + +impl<'valid, Heap: Allocator> Allocator for Allocref<'valid, Heap> { + fn allocate(&self, layout: Layout) -> Option> { + self.0.allocate(layout) + } + + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { + unsafe { self.0.deallocate(pointer, layout) }; + } + + unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { + unsafe { self.0.grow(pointer, old, new) } + } + + unsafe fn shrink( + &self, + pointer: NonNull, + old: Layout, + new: Layout + ) -> Option> { + unsafe { self.0.shrink(pointer, old, new) } + } +} diff --git a/src/iterators/splice.rs b/src/iterators/splice/mod.rs similarity index 88% rename from src/iterators/splice.rs rename to src/iterators/splice/mod.rs index 2f231d17..7cd407a0 100644 --- a/src/iterators/splice.rs +++ b/src/iterators/splice/mod.rs @@ -1,8 +1,15 @@ -use crate::{ - Allocator, - Drain, - Global, - SmallVec +mod allocref; + +use { + allocref::Allocref, + super::{ + super::{ + Allocator, + Global, + SmallVec + }, + drain::Drain + } }; pub struct Splice<'a, I: Iterator + 'a, const N: usize, A: Allocator = Global> { @@ -81,12 +88,9 @@ impl Drop for Splice<'_, I, N, A> { } } - // Collect any remaining elements. - let mut collected = self - .replace_with - .by_ref() - .collect::>() - .into_iter(); + let mut smallvec = SmallVec::<_, N, _>::new_in(Allocref(&self.drain.vec.as_ref().allocator)); + smallvec.extend(self.replace_with.by_ref()); + let mut collected = smallvec.into_iter(); // Now we have an exact count. if collected.len() > 0 { From f457c6b644a18f9e61563a6497c577341b63f1ef Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 5 Oct 2026 14:27:52 +0200 Subject: [PATCH 2/9] chore: inline methods --- src/iterators/splice/allocref.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/iterators/splice/allocref.rs b/src/iterators/splice/allocref.rs index a61e22b6..1959b78b 100644 --- a/src/iterators/splice/allocref.rs +++ b/src/iterators/splice/allocref.rs @@ -9,18 +9,22 @@ use { pub struct Allocref<'valid, Heap: Allocator>(pub &'valid Heap); impl<'valid, Heap: Allocator> Allocator for Allocref<'valid, Heap> { + #[inline] fn allocate(&self, layout: Layout) -> Option> { self.0.allocate(layout) } + #[inline] unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { unsafe { self.0.deallocate(pointer, layout) }; } + #[inline] unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { unsafe { self.0.grow(pointer, old, new) } } + #[inline] unsafe fn shrink( &self, pointer: NonNull, From 54f15078a9ac6e0844c84c4f27e43620aae61cfb Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 5 Oct 2026 14:28:31 +0200 Subject: [PATCH 3/9] style: formatting --- src/iterators/splice/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/iterators/splice/mod.rs b/src/iterators/splice/mod.rs index 7cd407a0..281a61aa 100644 --- a/src/iterators/splice/mod.rs +++ b/src/iterators/splice/mod.rs @@ -1,7 +1,6 @@ mod allocref; use { - allocref::Allocref, super::{ super::{ Allocator, @@ -9,7 +8,8 @@ use { SmallVec }, drain::Drain - } + }, + allocref::Allocref }; pub struct Splice<'a, I: Iterator + 'a, const N: usize, A: Allocator = Global> { @@ -88,7 +88,8 @@ impl Drop for Splice<'_, I, N, A> { } } - let mut smallvec = SmallVec::<_, N, _>::new_in(Allocref(&self.drain.vec.as_ref().allocator)); + let mut smallvec = + SmallVec::<_, N, _>::new_in(Allocref(&self.drain.vec.as_ref().allocator)); smallvec.extend(self.replace_with.by_ref()); let mut collected = smallvec.into_iter(); From 594a982206dac2ed73106c9d06573c89a4065dc0 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 5 Oct 2026 14:32:43 +0200 Subject: [PATCH 4/9] chore: add repr transparent --- src/iterators/splice/allocref.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/iterators/splice/allocref.rs b/src/iterators/splice/allocref.rs index 1959b78b..ca5acd0a 100644 --- a/src/iterators/splice/allocref.rs +++ b/src/iterators/splice/allocref.rs @@ -6,6 +6,7 @@ use { } }; +#[repr(transparent)] pub struct Allocref<'valid, Heap: Allocator>(pub &'valid Heap); impl<'valid, Heap: Allocator> Allocator for Allocref<'valid, Heap> { From 3f91a9d39e3945005ef87a185588aaa1fcfe7d68 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Tue, 6 Oct 2026 12:34:00 +0200 Subject: [PATCH 5/9] refactor: rename to proxy --- src/allocator/mod.rs | 1 + .../splice/allocref.rs => allocator/proxy.rs} | 4 ++-- src/iterators/{splice/mod.rs => splice.rs} | 10 ++++------ 3 files changed, 7 insertions(+), 8 deletions(-) rename src/{iterators/splice/allocref.rs => allocator/proxy.rs} (85%) rename src/iterators/{splice/mod.rs => splice.rs} (95%) diff --git a/src/allocator/mod.rs b/src/allocator/mod.rs index 2e212219..5e67a3a8 100644 --- a/src/allocator/mod.rs +++ b/src/allocator/mod.rs @@ -4,6 +4,7 @@ mod base; mod external; #[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] mod native; +pub mod proxy; use core::{ alloc::Layout, diff --git a/src/iterators/splice/allocref.rs b/src/allocator/proxy.rs similarity index 85% rename from src/iterators/splice/allocref.rs rename to src/allocator/proxy.rs index ca5acd0a..9628da89 100644 --- a/src/iterators/splice/allocref.rs +++ b/src/allocator/proxy.rs @@ -7,9 +7,9 @@ use { }; #[repr(transparent)] -pub struct Allocref<'valid, Heap: Allocator>(pub &'valid Heap); +pub struct Proxy<'valid, Heap: Allocator>(pub &'valid Heap); -impl<'valid, Heap: Allocator> Allocator for Allocref<'valid, Heap> { +impl<'valid, Heap: Allocator> Allocator for Proxy<'valid, Heap> { #[inline] fn allocate(&self, layout: Layout) -> Option> { self.0.allocate(layout) diff --git a/src/iterators/splice/mod.rs b/src/iterators/splice.rs similarity index 95% rename from src/iterators/splice/mod.rs rename to src/iterators/splice.rs index 281a61aa..0cee6c1c 100644 --- a/src/iterators/splice/mod.rs +++ b/src/iterators/splice.rs @@ -1,15 +1,13 @@ -mod allocref; - use { super::{ super::{ Allocator, Global, - SmallVec + SmallVec, + allocator::proxy::Proxy }, drain::Drain - }, - allocref::Allocref + } }; pub struct Splice<'a, I: Iterator + 'a, const N: usize, A: Allocator = Global> { @@ -89,7 +87,7 @@ impl Drop for Splice<'_, I, N, A> { } let mut smallvec = - SmallVec::<_, N, _>::new_in(Allocref(&self.drain.vec.as_ref().allocator)); + SmallVec::<_, N, _>::new_in(Proxy(&self.drain.vec.as_ref().allocator)); smallvec.extend(self.replace_with.by_ref()); let mut collected = smallvec.into_iter(); From 3cfbd2f85b86e1de4582a52cc4d6770a3b875cf8 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Tue, 6 Oct 2026 12:56:45 +0200 Subject: [PATCH 6/9] refactor: better allocator org --- src/allocator/base.rs | 35 ---------------- src/allocator/boxed.rs | 4 ++ src/allocator/external.rs | 26 ------------ src/allocator/global.rs | 7 ++++ src/allocator/implementations/base.rs | 51 +++++++++++++++++++++++ src/allocator/implementations/external.rs | 35 ++++++++++++++++ src/allocator/implementations/mod.rs | 6 +++ src/allocator/implementations/native.rs | 35 ++++++++++++++++ src/allocator/mod.rs | 37 ++-------------- src/allocator/vec.rs | 13 ++++++ src/iterators/mod.rs | 3 +- src/iterators/splice.rs | 16 ++++--- src/lib.rs | 10 +++-- 13 files changed, 169 insertions(+), 109 deletions(-) create mode 100644 src/allocator/boxed.rs create mode 100644 src/allocator/global.rs create mode 100644 src/allocator/implementations/base.rs create mode 100644 src/allocator/implementations/external.rs create mode 100644 src/allocator/implementations/mod.rs create mode 100644 src/allocator/implementations/native.rs create mode 100644 src/allocator/vec.rs diff --git a/src/allocator/base.rs b/src/allocator/base.rs index 76ec54e8..8eac6cc7 100644 --- a/src/allocator/base.rs +++ b/src/allocator/base.rs @@ -14,38 +14,3 @@ use { #[derive(Clone)] pub struct Global; -impl Allocator for Global { - #[inline] - fn allocate(&self, layout: Layout) -> Option> { - Some(NonNull::slice_from_raw_parts( - NonNull::new(unsafe { alloc(layout) })?, - layout.size() - )) - } - - #[inline] - unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { - unsafe { dealloc(pointer.as_ptr(), layout) }; - } - - #[inline] - unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { - Some(NonNull::slice_from_raw_parts( - NonNull::new(unsafe { realloc(pointer.as_ptr(), old, new.size()) })?, - new.size() - )) - } - - #[inline] - unsafe fn shrink( - &self, - pointer: NonNull, - old: Layout, - new: Layout - ) -> Option> { - Some(NonNull::slice_from_raw_parts( - NonNull::new(unsafe { realloc(pointer.as_ptr(), old, new.size()) })?, - new.size() - )) - } -} diff --git a/src/allocator/boxed.rs b/src/allocator/boxed.rs new file mode 100644 index 00000000..9d27af95 --- /dev/null +++ b/src/allocator/boxed.rs @@ -0,0 +1,4 @@ +#[cfg(not(feature = "allocator-api2"))] +pub use alloc::boxed::Box; +#[cfg(feature = "allocator-api2")] +pub use allocator_api2::boxed::Box; diff --git a/src/allocator/external.rs b/src/allocator/external.rs index 635a8697..4c5bb96b 100644 --- a/src/allocator/external.rs +++ b/src/allocator/external.rs @@ -7,29 +7,3 @@ use { } }; -impl Allocator for Type { - #[inline] - fn allocate(&self, layout: Layout) -> Option> { - External::allocate(&self, layout).ok() - } - - #[inline] - unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { - unsafe { External::deallocate(&self, pointer, layout) } - } - - #[inline] - unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { - unsafe { External::grow(&self, pointer, old, new).ok() } - } - - #[inline] - unsafe fn shrink( - &self, - pointer: NonNull, - old: Layout, - new: Layout - ) -> Option> { - unsafe { External::shrink(&self, pointer, old, new).ok() } - } -} diff --git a/src/allocator/global.rs b/src/allocator/global.rs new file mode 100644 index 00000000..403abd76 --- /dev/null +++ b/src/allocator/global.rs @@ -0,0 +1,7 @@ +#[cfg(not(feature = "allocator-api"))] +pub struct Global; + +#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] +pub use alloc::alloc::Global; +#[cfg(feature = "allocator-api2")] +pub use allocator_api2::alloc::Global; diff --git a/src/allocator/implementations/base.rs b/src/allocator/implementations/base.rs new file mode 100644 index 00000000..996586fd --- /dev/null +++ b/src/allocator/implementations/base.rs @@ -0,0 +1,51 @@ +use { + super::super::{ + Allocator, + global::Global + }, + alloc::alloc::{ + alloc, + dealloc, + realloc + }, + core::{ + alloc::Layout, + ptr::NonNull + } +}; + +impl Allocator for Global { + #[inline] + fn allocate(&self, layout: Layout) -> Option> { + Some(NonNull::slice_from_raw_parts( + NonNull::new(unsafe { alloc(layout) })?, + layout.size() + )) + } + + #[inline] + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { + unsafe { dealloc(pointer.as_ptr(), layout) }; + } + + #[inline] + unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { + Some(NonNull::slice_from_raw_parts( + NonNull::new(unsafe { realloc(pointer.as_ptr(), old, new.size()) })?, + new.size() + )) + } + + #[inline] + unsafe fn shrink( + &self, + pointer: NonNull, + old: Layout, + new: Layout + ) -> Option> { + Some(NonNull::slice_from_raw_parts( + NonNull::new(unsafe { realloc(pointer.as_ptr(), old, new.size()) })?, + new.size() + )) + } +} diff --git a/src/allocator/implementations/external.rs b/src/allocator/implementations/external.rs new file mode 100644 index 00000000..72083f23 --- /dev/null +++ b/src/allocator/implementations/external.rs @@ -0,0 +1,35 @@ +use { + super::super::Allocator, + allocator_api2::alloc::Allocator as External, + core::{ + alloc::Layout, + ptr::NonNull + } +}; + +impl Allocator for Type { + #[inline] + fn allocate(&self, layout: Layout) -> Option> { + External::allocate(&self, layout).ok() + } + + #[inline] + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { + unsafe { External::deallocate(&self, pointer, layout) } + } + + #[inline] + unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { + unsafe { External::grow(&self, pointer, old, new).ok() } + } + + #[inline] + unsafe fn shrink( + &self, + pointer: NonNull, + old: Layout, + new: Layout + ) -> Option> { + unsafe { External::shrink(&self, pointer, old, new).ok() } + } +} diff --git a/src/allocator/implementations/mod.rs b/src/allocator/implementations/mod.rs new file mode 100644 index 00000000..59ab2e1e --- /dev/null +++ b/src/allocator/implementations/mod.rs @@ -0,0 +1,6 @@ +#[cfg(not(feature = "allocator-api"))] +mod base; +#[cfg(feature = "allocator-api2")] +mod external; +#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] +mod native; diff --git a/src/allocator/implementations/native.rs b/src/allocator/implementations/native.rs new file mode 100644 index 00000000..70ef0866 --- /dev/null +++ b/src/allocator/implementations/native.rs @@ -0,0 +1,35 @@ +use { + super::super::Allocator, + alloc::alloc::Allocator as Native, + core::{ + alloc::Layout, + ptr::NonNull + } +}; + +impl Allocator for Type { + #[inline] + fn allocate(&self, layout: Layout) -> Option> { + Native::allocate(&self, layout).ok() + } + + #[inline] + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { + unsafe { Native::deallocate(&self, pointer, layout) } + } + + #[inline] + unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { + unsafe { Native::grow(&self, pointer, old, new).ok() } + } + + #[inline] + unsafe fn shrink( + &self, + pointer: NonNull, + old: Layout, + new: Layout + ) -> Option> { + unsafe { Native::shrink(&self, pointer, old, new).ok() } + } +} diff --git a/src/allocator/mod.rs b/src/allocator/mod.rs index 5e67a3a8..46927df0 100644 --- a/src/allocator/mod.rs +++ b/src/allocator/mod.rs @@ -1,43 +1,14 @@ -#[cfg(not(feature = "allocator-api"))] -mod base; -#[cfg(feature = "allocator-api2")] -mod external; -#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] -mod native; +pub mod boxed; +pub mod global; +mod implementations; pub mod proxy; +pub mod vec; use core::{ alloc::Layout, ptr::NonNull }; -#[cfg(not(feature = "allocator-api"))] -#[rustfmt::skip] -pub use { - alloc::{ - boxed::Box, - vec::Vec, - vec - }, - base::Global -}; -#[cfg(feature = "allocator-api2")] -#[rustfmt::skip] -pub use allocator_api2::{ - alloc::Global, - boxed::Box, - vec::Vec, - vec -}; -#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] -#[rustfmt::skip] -pub use alloc::{ - alloc::Global, - boxed::Box, - vec::Vec, - vec -}; - pub trait Allocator { fn allocate(&self, layout: Layout) -> Option>; unsafe fn deallocate(&self, pointer: NonNull, layout: Layout); diff --git a/src/allocator/vec.rs b/src/allocator/vec.rs new file mode 100644 index 00000000..a1181229 --- /dev/null +++ b/src/allocator/vec.rs @@ -0,0 +1,13 @@ +#[cfg(not(feature = "allocator-api2"))] +#[rustfmt::skip] +pub use alloc::{ + vec, + vec::Vec +}; + +#[cfg(feature = "allocator-api2")] +#[rustfmt::skip] +pub use allocator_api2::{ + vec, + vec::Vec +}; diff --git a/src/iterators/mod.rs b/src/iterators/mod.rs index 40585e0c..78953514 100644 --- a/src/iterators/mod.rs +++ b/src/iterators/mod.rs @@ -1,7 +1,6 @@ pub mod drain; pub mod extractif; pub mod intoiter; -pub mod splice; - #[cfg(feature = "rayon")] mod rayon; +pub mod splice; diff --git a/src/iterators/splice.rs b/src/iterators/splice.rs index 0cee6c1c..f827b6f0 100644 --- a/src/iterators/splice.rs +++ b/src/iterators/splice.rs @@ -1,13 +1,11 @@ -use { +use super::{ super::{ - super::{ - Allocator, - Global, - SmallVec, - allocator::proxy::Proxy - }, - drain::Drain - } + Allocator, + Global, + SmallVec, + allocator::proxy::Proxy + }, + drain::Drain }; pub struct Splice<'a, I: Iterator + 'a, const N: usize, A: Allocator = Global> { diff --git a/src/lib.rs b/src/lib.rs index 3e3a624d..4b651d7a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,10 +58,12 @@ use std::io; use { allocator::{ Allocator, - Box, - Global, - Vec, - vec + boxed::Box, + global::Global, + vec::{ + Vec, + vec + } }, core::{ alloc::Layout, From 287f323bde2b9007adcff525c5d58ad3a619280e Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Tue, 6 Oct 2026 13:03:45 +0200 Subject: [PATCH 7/9] style: reorder --- src/allocator/implementations/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/allocator/implementations/mod.rs b/src/allocator/implementations/mod.rs index 59ab2e1e..1eee772e 100644 --- a/src/allocator/implementations/mod.rs +++ b/src/allocator/implementations/mod.rs @@ -1,6 +1,6 @@ #[cfg(not(feature = "allocator-api"))] mod base; -#[cfg(feature = "allocator-api2")] -mod external; #[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] mod native; +#[cfg(feature = "allocator-api2")] +mod external; \ No newline at end of file From 991aebf8a5d6e16321e976ce2388071d25ae60ad Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Tue, 6 Oct 2026 13:06:53 +0200 Subject: [PATCH 8/9] fix: clonable --- src/allocator/base.rs | 16 ---------------- src/allocator/external.rs | 9 --------- src/allocator/global.rs | 2 +- src/allocator/native.rs | 35 ----------------------------------- 4 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 src/allocator/base.rs delete mode 100644 src/allocator/external.rs delete mode 100644 src/allocator/native.rs diff --git a/src/allocator/base.rs b/src/allocator/base.rs deleted file mode 100644 index 8eac6cc7..00000000 --- a/src/allocator/base.rs +++ /dev/null @@ -1,16 +0,0 @@ -use { - super::Allocator, - alloc::alloc::{ - alloc, - dealloc, - realloc - }, - core::{ - alloc::Layout, - ptr::NonNull - } -}; - -#[derive(Clone)] -pub struct Global; - diff --git a/src/allocator/external.rs b/src/allocator/external.rs deleted file mode 100644 index 4c5bb96b..00000000 --- a/src/allocator/external.rs +++ /dev/null @@ -1,9 +0,0 @@ -use { - super::Allocator, - allocator_api2::alloc::Allocator as External, - core::{ - alloc::Layout, - ptr::NonNull - } -}; - diff --git a/src/allocator/global.rs b/src/allocator/global.rs index 403abd76..67af50c6 100644 --- a/src/allocator/global.rs +++ b/src/allocator/global.rs @@ -1,6 +1,6 @@ #[cfg(not(feature = "allocator-api"))] +#[derive(Clone)] pub struct Global; - #[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] pub use alloc::alloc::Global; #[cfg(feature = "allocator-api2")] diff --git a/src/allocator/native.rs b/src/allocator/native.rs deleted file mode 100644 index 77603616..00000000 --- a/src/allocator/native.rs +++ /dev/null @@ -1,35 +0,0 @@ -use { - super::Allocator, - alloc::alloc::Allocator as Native, - core::{ - alloc::Layout, - ptr::NonNull - } -}; - -impl Allocator for Type { - #[inline] - fn allocate(&self, layout: Layout) -> Option> { - Native::allocate(&self, layout).ok() - } - - #[inline] - unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { - unsafe { Native::deallocate(&self, pointer, layout) } - } - - #[inline] - unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { - unsafe { Native::grow(&self, pointer, old, new).ok() } - } - - #[inline] - unsafe fn shrink( - &self, - pointer: NonNull, - old: Layout, - new: Layout - ) -> Option> { - unsafe { Native::shrink(&self, pointer, old, new).ok() } - } -} From d86600d0f98674b38b39a52ee38bc388b328c993 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Tue, 6 Oct 2026 13:07:39 +0200 Subject: [PATCH 9/9] style: formatting --- src/allocator/implementations/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/allocator/implementations/mod.rs b/src/allocator/implementations/mod.rs index 1eee772e..59ab2e1e 100644 --- a/src/allocator/implementations/mod.rs +++ b/src/allocator/implementations/mod.rs @@ -1,6 +1,6 @@ #[cfg(not(feature = "allocator-api"))] mod base; +#[cfg(feature = "allocator-api2")] +mod external; #[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] mod native; -#[cfg(feature = "allocator-api2")] -mod external; \ No newline at end of file