remove deprecated items

This commit is contained in:
Trevor Spiteri 2020-04-18 02:21:17 +02:00
parent 7585a665a5
commit f67aed0078
8 changed files with 20 additions and 379 deletions

View File

@ -89,7 +89,7 @@ x86_64-gnulinux-tarpaulin:
image: amd64/rust:1 image: amd64/rust:1
variables: variables:
TARGET: x86_64 TARGET: x86_64
REQ_COVERAGE: "86.2" REQ_COVERAGE: "87.9"
cache: cache:
key: $CI_JOB_NAME key: $CI_JOB_NAME
paths: paths:

View File

@ -74,6 +74,10 @@ The conversions supported cover the following cases.
## Whats new ## Whats new
### Version 1.0.0 news (unreleased)
* All deprecated items were removed.
### Version 0.5.5 news (2020-04-16) ### Version 0.5.5 news (2020-04-16)
* Bug fix: an incorrect result could be given when comparing a * Bug fix: an incorrect result could be given when comparing a

View File

@ -5,6 +5,11 @@ modification, are permitted in any medium without royalty provided the
copyright notice and this notice are preserved. This file is offered copyright notice and this notice are preserved. This file is offered
as-is, without any warranty. --> as-is, without any warranty. -->
Version 1.0.0 (unreleased)
==========================
* All deprecated items were removed.
Version 0.5.5 (2020-04-16) Version 0.5.5 (2020-04-16)
========================== ==========================

View File

@ -18,14 +18,11 @@ use crate::{
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64, FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8, FixedU8,
}; };
#[allow(deprecated)]
use az::StaticCast;
use az::{Cast, CheckedCast, OverflowingCast, SaturatingCast, WrappingCast}; use az::{Cast, CheckedCast, OverflowingCast, SaturatingCast, WrappingCast};
use core::mem;
#[cfg(feature = "f16")] #[cfg(feature = "f16")]
use half::{bf16, f16}; use half::{bf16, f16};
macro_rules! run_time { macro_rules! cast {
($Src:ident($LeEqUSrc:ident); $Dst:ident($LeEqUDst:ident)) => { ($Src:ident($LeEqUSrc:ident); $Dst:ident($LeEqUDst:ident)) => {
impl<FracSrc: $LeEqUSrc, FracDst: $LeEqUDst> Cast<$Dst<FracDst>> for $Src<FracSrc> { impl<FracSrc: $LeEqUSrc, FracDst: $LeEqUDst> Cast<$Dst<FracDst>> for $Src<FracSrc> {
#[inline] #[inline]
@ -142,269 +139,38 @@ macro_rules! run_time {
}; };
} }
macro_rules! compile_time { macro_rules! cast_num {
(
impl<$FracSrc:ident: $LeEqUSrc:ident, $FracDst:ident: $LeEqUDst:ident> StaticCast<$Dst:ty>
for $Src:ty
{
$cond:expr
}
) => {
#[deprecated(since = "0.5.6", note = "deprecated in az crate")]
#[allow(deprecated)]
/// <div class='stability'><div class='stab deprecated'>Deprecated since 0.5.6:
/// <p>deprecated in az crate since 0.3.1; use case is unclear</p></div></div>
impl<$FracSrc: $LeEqUSrc, $FracDst: $LeEqUDst> StaticCast<$Dst> for $Src {
#[inline]
fn static_cast(self) -> Option<$Dst> {
if $cond {
Some(az::cast(self))
} else {
None
}
}
}
};
(impl<$Frac:ident: $LeEqU:ident> StaticCast<$Dst:ty> for $Src:ty { $cond:expr }) => {
#[deprecated(since = "0.5.6", note = "deprecated in az crate")]
#[allow(deprecated)]
/// <div class='stability'><div class='stab deprecated'>Deprecated since 0.5.6:
/// <p>deprecated in az crate since 0.3.1; use case is unclear</p></div></div>
impl<$Frac: $LeEqU> StaticCast<$Dst> for $Src {
#[inline]
fn static_cast(self) -> Option<$Dst> {
if $cond {
Some(az::cast(self))
} else {
None
}
}
}
};
($SrcI:ident, $SrcU:ident($LeEqUSrc:ident); $DstI:ident, $DstU:ident($LeEqUDst:ident)) => {
compile_time! {
impl<FracSrc: $LeEqUSrc, FracDst: $LeEqUDst> StaticCast<$DstI<FracDst>>
for $SrcI<FracSrc>
{
<$DstI<FracDst>>::INT_NBITS >= <$SrcI<FracSrc>>::INT_NBITS
}
}
compile_time! {
impl<FracSrc: $LeEqUSrc, FracDst: $LeEqUDst> StaticCast<$DstU<FracDst>>
for $SrcI<FracSrc>
{
false
}
}
compile_time! {
impl<FracSrc: $LeEqUSrc, FracDst: $LeEqUDst> StaticCast<$DstI<FracDst>>
for $SrcU<FracSrc>
{
<$DstI<FracDst>>::INT_NBITS > <$SrcU<FracSrc>>::INT_NBITS
}
}
compile_time! {
impl<FracSrc: $LeEqUSrc, FracDst: $LeEqUDst> StaticCast<$DstU<FracDst>>
for $SrcU<FracSrc>
{
<$DstU<FracDst>>::INT_NBITS >= <$SrcU<FracSrc>>::INT_NBITS
}
}
};
($FixedI:ident, $FixedU:ident($LeEqU:ident); int $DstI:ident, $DstU:ident) => {
compile_time! {
impl<Frac: $LeEqU> StaticCast<$DstI> for $FixedI<Frac> {
8 * mem::size_of::<$DstI>() as u32 >= <$FixedI<Frac>>::INT_NBITS
}
}
compile_time! {
impl<Frac: $LeEqU> StaticCast<$DstI> for $FixedU<Frac> {
8 * mem::size_of::<$DstI>() as u32 > <$FixedU<Frac>>::INT_NBITS
}
}
compile_time! {
impl<Frac: $LeEqU> StaticCast<$DstU> for $FixedI<Frac> {
false
}
}
compile_time! {
impl<Frac: $LeEqU> StaticCast<$DstU> for $FixedU<Frac> {
8 * mem::size_of::<$DstU>() as u32 >= <$FixedU<Frac>>::INT_NBITS
}
}
};
(int $SrcI:ident, $SrcU:ident; $FixedI:ident, $FixedU:ident($LeEqU:ident)) => {
compile_time! {
impl<Frac: $LeEqU> StaticCast<$FixedI<Frac>> for $SrcI {
<$FixedI<Frac>>::INT_NBITS >= 8 * mem::size_of::<$SrcI>() as u32
}
}
compile_time! {
impl<Frac: $LeEqU> StaticCast<$FixedU<Frac>> for $SrcI {
false
}
}
compile_time! {
impl<Frac: $LeEqU> StaticCast<$FixedI<Frac>> for $SrcU {
<$FixedI<Frac>>::INT_NBITS > 8 * mem::size_of::<$SrcU>() as u32
}
}
compile_time! {
impl<Frac: $LeEqU> StaticCast<$FixedU<Frac>> for $SrcU {
<$FixedU<Frac>>::INT_NBITS >= 8 * mem::size_of::<$SrcU>() as u32
}
}
};
($Fixed:ident($LeEqU:ident); float $Dst:ident) => {
compile_time! {
impl<Frac: $LeEqU> StaticCast<$Dst> for $Fixed<Frac> {
true
}
}
};
(float $Src:ident; $Fixed:ident($LeEqU:ident)) => {
compile_time! {
impl<Frac: $LeEqU> StaticCast<$Fixed<Frac>> for $Src {
false
}
}
};
}
macro_rules! run_time_num {
($Src:ident($LeEqUSrc:ident); $($Dst:ident($LeEqUDst:ident),)*) => { $( ($Src:ident($LeEqUSrc:ident); $($Dst:ident($LeEqUDst:ident),)*) => { $(
run_time! { $Src($LeEqUSrc); $Dst($LeEqUDst) } cast! { $Src($LeEqUSrc); $Dst($LeEqUDst) }
)* }; )* };
($Fixed:ident($LeEqU:ident); $($Num:ident,)*) => { $( ($Fixed:ident($LeEqU:ident); $($Num:ident,)*) => { $(
run_time! { $Fixed($LeEqU); $Num } cast! { $Fixed($LeEqU); $Num }
run_time! { $Num; $Fixed($LeEqU) } cast! { $Num; $Fixed($LeEqU) }
)* }; )* };
($($Fixed:ident($LeEqU:ident),)*) => { $( ($($Fixed:ident($LeEqU:ident),)*) => { $(
run_time_num! { cast_num! {
$Fixed($LeEqU); $Fixed($LeEqU);
FixedI8(LeEqU8), FixedI16(LeEqU16), FixedI32(LeEqU32), FixedI64(LeEqU64), FixedI8(LeEqU8), FixedI16(LeEqU16), FixedI32(LeEqU32), FixedI64(LeEqU64),
FixedI128(LeEqU128), FixedI128(LeEqU128),
FixedU8(LeEqU8), FixedU16(LeEqU16), FixedU32(LeEqU32), FixedU64(LeEqU64), FixedU8(LeEqU8), FixedU16(LeEqU16), FixedU32(LeEqU32), FixedU64(LeEqU64),
FixedU128(LeEqU128), FixedU128(LeEqU128),
} }
run_time! { bool; $Fixed($LeEqU) } cast! { bool; $Fixed($LeEqU) }
run_time_num! { cast_num! {
$Fixed($LeEqU); $Fixed($LeEqU);
i8, i16, i32, i64, i128, isize, i8, i16, i32, i64, i128, isize,
u8, u16, u32, u64, u128, usize, u8, u16, u32, u64, u128, usize,
f32, f64, f32, f64,
} }
#[cfg(feature = "f16")] #[cfg(feature = "f16")]
run_time_num! { cast_num! {
$Fixed($LeEqU); $Fixed($LeEqU);
f16, bf16, f16, bf16,
} }
)* }; )* };
} }
run_time_num! { cast_num! {
FixedI8(LeEqU8), FixedI16(LeEqU16), FixedI32(LeEqU32), FixedI64(LeEqU64), FixedI128(LeEqU128),
FixedU8(LeEqU8), FixedU16(LeEqU16), FixedU32(LeEqU32), FixedU64(LeEqU64), FixedU128(LeEqU128),
}
macro_rules! compile_time_fixed {
(
$SrcI:ident, $SrcU:ident($LeEqUSrc:ident); $(($DstI:ident, $DstU:ident($LeEqUDst:ident)),)*
) => { $(
compile_time! { $SrcI, $SrcU($LeEqUSrc); $DstI, $DstU($LeEqUDst) }
)* };
($($FixedI:ident, $FixedU:ident($LeEqU:ident),)*) => { $(
compile_time_fixed! {
$FixedI, $FixedU($LeEqU);
(FixedI8, FixedU8(LeEqU8)),
(FixedI16, FixedU16(LeEqU16)),
(FixedI32, FixedU32(LeEqU32)),
(FixedI64, FixedU64(LeEqU64)),
(FixedI128, FixedU128(LeEqU128)),
}
)* };
}
compile_time_fixed! {
FixedI8, FixedU8(LeEqU8),
FixedI16, FixedU16(LeEqU16),
FixedI32, FixedU32(LeEqU32),
FixedI64, FixedU64(LeEqU64),
FixedI128, FixedU128(LeEqU128),
}
macro_rules! compile_time_int {
($FixedI:ident, $FixedU:ident($LeEqU:ident); $(($IntI:ident, $IntU:ident),)*) => { $(
compile_time! { $FixedI, $FixedU($LeEqU); int $IntI, $IntU }
compile_time! { int $IntI, $IntU; $FixedI, $FixedU($LeEqU) }
)* };
($($FixedI:ident, $FixedU:ident($LeEqU:ident),)*) => { $(
compile_time! {
impl<Frac: $LeEqU> StaticCast<$FixedI<Frac>> for bool {
<$FixedI<Frac>>::INT_NBITS > 1
}
}
compile_time! {
impl<Frac: $LeEqU> StaticCast<$FixedU<Frac>> for bool {
<$FixedU<Frac>>::INT_NBITS >= 1
}
}
compile_time_int! {
$FixedI, $FixedU($LeEqU);
(i8, u8),
(i16, u16),
(i32, u32),
(i64, u64),
(i128, u128),
(isize, usize),
}
)* };
}
compile_time_int! {
FixedI8, FixedU8(LeEqU8),
FixedI16, FixedU16(LeEqU16),
FixedI32, FixedU32(LeEqU32),
FixedI64, FixedU64(LeEqU64),
FixedI128, FixedU128(LeEqU128),
}
macro_rules! compile_time_float {
($Fixed:ident($LeEqU:ident); $($Float:ident,)*) => { $(
compile_time! { $Fixed($LeEqU); float $Float }
compile_time! { float $Float; $Fixed($LeEqU) }
)* };
($($Fixed:ident($LeEqU:ident),)*) => { $(
compile_time_float! {
$Fixed($LeEqU);
f32, f64,
}
#[cfg(feature = "f16")]
compile_time_float! {
$Fixed($LeEqU);
f16, bf16,
}
)* };
}
compile_time_float! {
FixedI8(LeEqU8), FixedI16(LeEqU16), FixedI32(LeEqU32), FixedI64(LeEqU64), FixedI128(LeEqU128), FixedI8(LeEqU8), FixedI16(LeEqU16), FixedI32(LeEqU32), FixedI64(LeEqU64), FixedI128(LeEqU128),
FixedU8(LeEqU8), FixedU16(LeEqU16), FixedU32(LeEqU32), FixedU64(LeEqU64), FixedU128(LeEqU128), FixedU8(LeEqU8), FixedU16(LeEqU16), FixedU32(LeEqU32), FixedU64(LeEqU64), FixedU128(LeEqU128),
} }

View File

@ -1075,42 +1075,6 @@ assert_eq!(Fix::from_num(-7.5).overflowing_rem_euclid_int(20), (Fix::from_num(-3
} }
} }
} }
/// Returns the number of integer bits.
#[inline]
#[deprecated(since = "0.5.5", note = "use `INT_NBITS` instead")]
pub fn int_nbits() -> u32 {
Self::INT_NBITS
}
/// Returns the number of fractional bits.
#[inline]
#[deprecated(since = "0.5.5", note = "use `FRAC_NBITS` instead")]
pub fn frac_nbits() -> u32 {
Self::FRAC_NBITS
}
/// Remainder for division by an integer.
///
/// # Panics
///
/// Panics if the divisor is zero.
#[inline]
#[deprecated(since = "0.5.3", note = "cannot overflow, use `%` or `Rem::rem` instead")]
pub fn wrapping_rem_int(self, rhs: $Inner) -> $Fixed<Frac> {
self % rhs
}
/// Remainder for division by an integer.
///
/// # Panics
///
/// Panics if the divisor is zero.
#[inline]
#[deprecated(since = "0.5.3", note = "cannot overflow, use `%` or `Rem::rem` instead")]
pub fn overflowing_rem_int(self, rhs: $Inner) -> ($Fixed<Frac>, bool) {
(self % rhs, false)
}
} }
}; };
} }

View File

@ -1423,20 +1423,6 @@ assert_eq!(Fix::MIN.overflowing_abs(), (Fix::MIN, true));
let not_mask = (cond as $Inner).wrapping_sub(1); let not_mask = (cond as $Inner).wrapping_sub(1);
Self::from_bits((self.to_bits() & !not_mask) | (otherwise.to_bits() & not_mask)) Self::from_bits((self.to_bits() & !not_mask) | (otherwise.to_bits() & not_mask))
} }
/// Returns the smallest value that can be represented.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `MIN`")]
pub const fn min_value() -> $Fixed<Frac> {
Self::MIN
}
/// Returns the largest value that can be represented.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `MAX`")]
pub const fn max_value() -> $Fixed<Frac> {
Self::MAX
}
} }
}; };
} }

View File

@ -997,62 +997,6 @@ where
/// [`bool`]: https://doc.rust-lang.org/nightly/std/primitive.bool.html /// [`bool`]: https://doc.rust-lang.org/nightly/std/primitive.bool.html
/// [tuple]: https://doc.rust-lang.org/nightly/std/primitive.tuple.html /// [tuple]: https://doc.rust-lang.org/nightly/std/primitive.tuple.html
fn overflowing_shr(self, rhs: u32) -> (Self, bool); fn overflowing_shr(self, rhs: u32) -> (Self, bool);
/// Returns the smallest value that can be represented.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `MIN`")]
fn min_value() -> Self {
Self::MIN
}
/// Returns the largest value that can be represented.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `MAX`")]
fn max_value() -> Self {
Self::MAX
}
/// Returns the number of integer bits.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `INT_NBITS`")]
fn int_nbits() -> u32 {
Self::INT_NBITS
}
/// Returns the number of fractional bits.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `FRAC_NBITS`")]
fn frac_nbits() -> u32 {
Self::FRAC_NBITS
}
/// Remainder for division by an integer.
///
/// # Panics
///
/// Panics if the divisor is zero.
#[inline]
#[deprecated(
since = "0.5.3",
note = "cannot overflow, use `%` or `Rem::rem` instead"
)]
fn wrapping_rem_int(self, rhs: Self::Bits) -> Self {
self % rhs
}
/// Remainder for division by an integer.
///
/// # Panics
///
/// Panics if the divisor is zero.
#[inline]
#[deprecated(
since = "0.5.3",
note = "cannot overflow, use `%` or `Rem::rem` instead"
)]
fn overflowing_rem_int(self, rhs: Self::Bits) -> (Self, bool) {
(self % rhs, false)
}
} }
/// This trait provides methods common to all signed fixed-point numbers. /// This trait provides methods common to all signed fixed-point numbers.

View File

@ -619,34 +619,6 @@ impl<F: Fixed> Wrapping<F> {
pub fn rem_euclid_int(self, divisor: F::Bits) -> Wrapping<F> { pub fn rem_euclid_int(self, divisor: F::Bits) -> Wrapping<F> {
Wrapping(self.0.wrapping_rem_euclid_int(divisor)) Wrapping(self.0.wrapping_rem_euclid_int(divisor))
} }
/// Returns the smallest value that can be represented.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `MIN`")]
pub fn min_value() -> Wrapping<F> {
Self::MIN
}
/// Returns the largest value that can be represented.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `MAX`")]
pub fn max_value() -> Wrapping<F> {
Self::MAX
}
/// Returns the number of integer bits.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `INT_NBITS`")]
pub fn int_nbits() -> u32 {
Self::INT_NBITS
}
/// Returns the number of fractional bits.
#[inline]
#[deprecated(since = "0.5.5", note = "replaced by `FRAC_NBITS`")]
pub fn frac_nbits() -> u32 {
Self::FRAC_NBITS
}
} }
impl<F: FixedSigned> Wrapping<F> { impl<F: FixedSigned> Wrapping<F> {