Skip to content

Commit

Permalink
Fix the cfg attributes for bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Jul 20, 2023
1 parent 2505954 commit 001dd32
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/ops/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use core::borrow::{Borrow, BorrowMut};
use core::cmp::{Eq, Ord, PartialEq, PartialOrd};
use core::fmt::Debug;
use core::hash::Hash;
#[cfg(not(has_int_to_from_bytes))]
use core::mem::transmute;

pub trait NumBytes:
Expand Down Expand Up @@ -160,7 +161,7 @@ pub trait FromBytes {

macro_rules! float_to_from_bytes_impl {
($T:ty, $I:ty, $L:expr) => {
#[cfg(feature = "has_float_to_from_bytes")]
#[cfg(has_float_to_from_bytes)]
impl ToBytes for $T {
type Bytes = [u8; $L];

Expand All @@ -180,7 +181,7 @@ macro_rules! float_to_from_bytes_impl {
}
}

#[cfg(feature = "has_float_to_from_bytes")]
#[cfg(has_float_to_from_bytes)]
impl FromBytes for $T {
type Bytes = [u8; $L];

Expand All @@ -200,7 +201,7 @@ macro_rules! float_to_from_bytes_impl {
}
}

#[cfg(not(feature = "has_float_to_from_bytes"))]
#[cfg(not(has_float_to_from_bytes))]
impl ToBytes for $T {
type Bytes = [u8; $L];

Expand All @@ -220,7 +221,7 @@ macro_rules! float_to_from_bytes_impl {
}
}

#[cfg(not(feature = "has_float_to_from_bytes"))]
#[cfg(not(has_float_to_from_bytes))]
impl FromBytes for $T {
type Bytes = [u8; $L];

Expand All @@ -244,7 +245,7 @@ macro_rules! float_to_from_bytes_impl {

macro_rules! int_to_from_bytes_impl {
($T:ty, $L:expr) => {
#[cfg(feature = "has_int_to_from_bytes")]
#[cfg(has_int_to_from_bytes)]
impl ToBytes for $T {
type Bytes = [u8; $L];

Expand All @@ -264,7 +265,7 @@ macro_rules! int_to_from_bytes_impl {
}
}

#[cfg(feature = "has_int_to_from_bytes")]
#[cfg(has_int_to_from_bytes)]
impl FromBytes for $T {
type Bytes = [u8; $L];

Expand All @@ -284,7 +285,7 @@ macro_rules! int_to_from_bytes_impl {
}
}

#[cfg(not(feature = "has_int_to_from_bytes"))]
#[cfg(not(has_int_to_from_bytes))]
impl ToBytes for $T {
type Bytes = [u8; $L];

Expand All @@ -304,7 +305,7 @@ macro_rules! int_to_from_bytes_impl {
}
}

#[cfg(not(feature = "has_int_to_from_bytes"))]
#[cfg(not(has_int_to_from_bytes))]
impl FromBytes for $T {
type Bytes = [u8; $L];

Expand Down

0 comments on commit 001dd32

Please sign in to comment.