RS.CLIPPY.HOST_ENDIAN_BYTES

Disallows usage of the `to_ne_bytes` method

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: host_endian_bytes. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for the usage of the to_ne_bytes method and/or the function from_ne_bytes.

Why restrict this?

To ensure use of explicitly chosen endianness rather than the target's endianness, such as when implementing network protocols or file formats rather than FFI.

Example

let _x = 2i32.to_ne_bytes();
let _y = 2i64.to_ne_bytes();