Avoid warnings with only_i32.

This commit is contained in:
Stephen Chung 2020-07-26 22:37:33 +08:00
parent ec5082c328
commit 2dd4d9bcf9

View File

@ -18,6 +18,8 @@ use num_traits::{
CheckedShr, CheckedSub, CheckedShr, CheckedSub,
}; };
#[cfg(not(feature = "only_i32"))]
#[cfg(not(feature = "only_i64"))]
use crate::stdlib::ops::{BitAnd, BitOr, BitXor}; use crate::stdlib::ops::{BitAnd, BitOr, BitXor};
#[cfg(any(feature = "unchecked", not(feature = "no_float")))] #[cfg(any(feature = "unchecked", not(feature = "no_float")))]
@ -145,12 +147,18 @@ where
} }
} }
// Bit operators // Bit operators
#[cfg(not(feature = "only_i32"))]
#[cfg(not(feature = "only_i64"))]
fn binary_and<T: BitAnd>(x: T, y: T) -> FuncReturn<<T as BitAnd>::Output> { fn binary_and<T: BitAnd>(x: T, y: T) -> FuncReturn<<T as BitAnd>::Output> {
Ok(x & y) Ok(x & y)
} }
#[cfg(not(feature = "only_i32"))]
#[cfg(not(feature = "only_i64"))]
fn binary_or<T: BitOr>(x: T, y: T) -> FuncReturn<<T as BitOr>::Output> { fn binary_or<T: BitOr>(x: T, y: T) -> FuncReturn<<T as BitOr>::Output> {
Ok(x | y) Ok(x | y)
} }
#[cfg(not(feature = "only_i32"))]
#[cfg(not(feature = "only_i64"))]
fn binary_xor<T: BitXor>(x: T, y: T) -> FuncReturn<<T as BitXor>::Output> { fn binary_xor<T: BitXor>(x: T, y: T) -> FuncReturn<<T as BitXor>::Output> {
Ok(x ^ y) Ok(x ^ y)
} }