Skip to content

Commit d4c5337

Browse files
committed
refactor(napi/parser): move global allocator declaration (#16237)
Pure refactor. Move `#[global_allocator]` declaration to after imports.
1 parent e3fbf14 commit d4c5337

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

napi/parser/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
#[cfg(all(
2-
feature = "allocator",
3-
not(any(target_arch = "arm", target_os = "freebsd", target_family = "wasm"))
4-
))]
5-
#[global_allocator]
6-
static ALLOC: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc;
7-
81
use std::mem;
92

103
use napi::{Task, bindgen_prelude::AsyncTask};
@@ -22,6 +15,13 @@ mod convert;
2215
mod types;
2316
pub use types::*;
2417

18+
#[cfg(all(
19+
feature = "allocator",
20+
not(any(target_arch = "arm", target_os = "freebsd", target_family = "wasm"))
21+
))]
22+
#[global_allocator]
23+
static ALLOC: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc;
24+
2525
// Raw transfer is only supported on 64-bit little-endian systems.
2626
// Don't include raw transfer code on other platforms (notably WASM32).
2727
// `raw_transfer_types` still needs to be compiled, as `assert_layouts` refers to those types,

0 commit comments

Comments
 (0)