Skip to content

Commit bb6e357

Browse files
committed
refactor(napi/parser): simplify raw_transfer_supported (#16238)
Pure refactor. Instead of having 2 feature-gated implementations of `raw_transfer_supported`, just have one. This makes it clearer on what platforms raw transfer is supported.
1 parent d4c5337 commit bb6e357

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

napi/parser/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ static ALLOC: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc;
3030
mod raw_transfer;
3131
mod raw_transfer_types;
3232
#[cfg(all(target_pointer_width = "64", target_endian = "little"))]
33-
pub use raw_transfer::{get_buffer_offset, parse_raw, parse_raw_sync, raw_transfer_supported};
33+
pub use raw_transfer::{get_buffer_offset, parse_raw, parse_raw_sync};
3434

35-
// Fallback for 32-bit or big-endian platforms.
3635
/// Returns `true` if raw transfer is supported on this platform.
37-
#[cfg(not(all(target_pointer_width = "64", target_endian = "little")))]
3836
#[napi]
3937
pub fn raw_transfer_supported() -> bool {
40-
false
38+
cfg!(all(target_pointer_width = "64", target_endian = "little"))
4139
}
4240

4341
mod generated {

napi/parser/src/raw_transfer.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,3 @@ unsafe fn parse_raw_impl(
285285
buffer_ptr.add(RAW_METADATA_OFFSET).cast::<RawTransferMetadata>().write(metadata);
286286
}
287287
}
288-
289-
/// Returns `true` if raw transfer is supported on this platform.
290-
//
291-
// This module is only compiled on 64-bit little-endian platforms.
292-
// Fallback version for unsupported platforms in `lib.rs`.
293-
#[napi]
294-
pub fn raw_transfer_supported() -> bool {
295-
true
296-
}

0 commit comments

Comments
 (0)