more consistent imports

This commit is contained in:
Trevor Spiteri 2019-08-06 22:54:21 +02:00
parent eae97c6b14
commit 5802e2a6e9
12 changed files with 102 additions and 123 deletions

View File

@ -1,18 +1,16 @@
#![cfg_attr(feature = "fail-on-warnings", deny(warnings))]
use {
criterion::{
black_box, criterion_group, criterion_main, Bencher, Benchmark, Criterion, Throughput,
},
fixed::{traits::Fixed, types::*},
num_traits::{One, Zero},
rand::{
distributions::{Distribution, Standard},
Rng,
},
rand_xoshiro::{rand_core::SeedableRng, Xoshiro256Plus},
std::convert::TryInto,
use criterion::{
black_box, criterion_group, criterion_main, Bencher, Benchmark, Criterion, Throughput,
};
use fixed::{traits::Fixed, types::*};
use num_traits::{One, Zero};
use rand::{
distributions::{Distribution, Standard},
Rng,
};
use rand_xoshiro::{rand_core::SeedableRng, Xoshiro256Plus};
use std::convert::TryInto;
const SEED: u64 = 42_069;
const DATASET_SIZE: usize = 10_000;

View File

@ -9,12 +9,14 @@
#![allow(unused_variables)]
#![cfg_attr(feature = "fail-on-warnings", deny(warnings))]
use std::env;
use std::ffi::OsString;
use std::fs::{self, File};
use std::io::{Result as IoResult, Write};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{
env,
ffi::OsString,
fs::{self, File},
io::{Result as IoResult, Write},
path::{Path, PathBuf},
process::Command,
};
struct Environment {
out_dir: PathBuf,

View File

@ -13,22 +13,20 @@
// <https://www.apache.org/licenses/LICENSE-2.0> and
// <https://opensource.org/licenses/MIT>.
use {
crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::SealedInt,
wide_div::WideDivRem,
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
},
core::{
cmp::Ordering,
iter::{Product, Sum},
ops::{
Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div,
DivAssign, Mul, MulAssign, Neg, Not, Rem, RemAssign, Shl, ShlAssign, Shr, ShrAssign,
Sub, SubAssign,
},
use crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::SealedInt,
wide_div::WideDivRem,
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
};
use core::{
cmp::Ordering,
iter::{Product, Sum},
ops::{
Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div,
DivAssign, Mul, MulAssign, Neg, Not, Rem, RemAssign, Shl, ShlAssign, Shr, ShrAssign, Sub,
SubAssign,
},
};

View File

@ -13,18 +13,16 @@
// <https://www.apache.org/licenses/LICENSE-2.0> and
// <https://opensource.org/licenses/MIT>.
use crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::{SealedFixed, SealedFloat, SealedInt, Widest},
traits::Fixed,
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
};
use core::cmp::Ordering;
#[cfg(feature = "f16")]
use half::f16;
use {
crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::{SealedFixed, SealedFloat, SealedInt, Widest},
traits::Fixed,
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
},
core::cmp::Ordering,
};
macro_rules! fixed_cmp_fixed {
($Lhs:ident($LhsNBits:ident), $Rhs:ident($RhsNBits:ident)) => {

View File

@ -13,20 +13,16 @@
// <https://www.apache.org/licenses/LICENSE-2.0> and
// <https://opensource.org/licenses/MIT>.
use crate::{
frac::{IsGreaterOrEqual, IsLessOrEqual, True, Unsigned, U0, U1, U128, U16, U2, U32, U64, U8},
sealed::SealedInt,
traits::{FromFixed, LossyFrom},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
};
use core::ops::{Add, Sub};
#[cfg(feature = "f16")]
use half::f16;
use {
crate::{
frac::{
IsGreaterOrEqual, IsLessOrEqual, True, Unsigned, U0, U1, U128, U16, U2, U32, U64, U8,
},
sealed::SealedInt,
traits::{FromFixed, LossyFrom},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
},
core::ops::{Add, Sub},
};
macro_rules! convert {
(($SrcU:ident, $SrcI:ident, $SrcBits:ident) -> ($DstU:ident, $DstI:ident, $DstBits:ident)) => {

View File

@ -13,18 +13,16 @@
// <https://www.apache.org/licenses/LICENSE-2.0> and
// <https://opensource.org/licenses/MIT>.
use {
crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::{SealedFixed, SealedInt},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
},
core::{
cmp::Ordering,
fmt::{Binary, Debug, Display, Formatter, LowerHex, Octal, Result as FmtResult, UpperHex},
str,
},
use crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::{SealedFixed, SealedInt},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
};
use core::{
cmp::Ordering,
fmt::{Binary, Debug, Display, Formatter, LowerHex, Octal, Result as FmtResult, UpperHex},
str,
};
trait Radix2 {

View File

@ -210,20 +210,18 @@ mod wide_div;
mod wrapping;
pub use crate::wrapping::Wrapping;
use crate::{
arith::MulDivDir,
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::{Fixed, Float, Int, SealedFixed, SealedFloat, SealedInt},
};
use core::{
cmp::Ordering,
hash::{Hash, Hasher},
marker::PhantomData,
};
#[cfg(feature = "f16")]
use half::f16;
use {
crate::{
arith::MulDivDir,
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::{Fixed, Float, Int, SealedFixed, SealedFloat, SealedInt},
},
core::{
cmp::Ordering,
hash::{Hash, Hasher},
marker::PhantomData,
},
};
/// A prelude for users of the *fixed* crate.
///

View File

@ -13,17 +13,15 @@
// <https://www.apache.org/licenses/LICENSE-2.0> and
// <https://opensource.org/licenses/MIT>.
use {
crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::{Fixed, SealedFloat, SealedInt},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
},
core::{
fmt::{Debug, Display},
hash::Hash,
},
use crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
sealed::{Fixed, SealedFloat, SealedInt},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
};
use core::{
fmt::{Debug, Display},
hash::Hash,
};
// Unsigned can have 0 ≤ x < 2↑128, that is its msb can be 0 or 1.

View File

@ -13,15 +13,13 @@
// <https://www.apache.org/licenses/LICENSE-2.0> and
// <https://opensource.org/licenses/MIT>.
use crate::sealed::{Fixed, SealedFixed, SealedInt, Widest};
use core::{
cmp::Ordering,
fmt::{Debug, Display},
};
#[cfg(feature = "f16")]
use half::f16;
use {
crate::sealed::{Fixed, SealedFixed, SealedInt, Widest},
core::{
cmp::Ordering,
fmt::{Debug, Display},
},
};
pub trait SealedFloat: Copy + Debug + Display {
type Bits: SealedInt;

View File

@ -13,17 +13,15 @@
// <https://www.apache.org/licenses/LICENSE-2.0> and
// <https://opensource.org/licenses/MIT>.
use {
crate::{
frac::{Bit, False, True, Unsigned, U0, U128, U16, U32, U64, U8},
sealed::{Fixed, SealedFixed, Widest},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
},
core::{
cmp::Ordering,
fmt::{Debug, Display},
},
use crate::{
frac::{Bit, False, True, Unsigned, U0, U128, U16, U32, U64, U8},
sealed::{Fixed, SealedFixed, Widest},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
};
use core::{
cmp::Ordering,
fmt::{Debug, Display},
};
pub trait SealedInt: Copy + Ord + Debug + Display {

View File

@ -13,17 +13,15 @@
// <https://www.apache.org/licenses/LICENSE-2.0> and
// <https://opensource.org/licenses/MIT>.
use {
crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
},
core::fmt::{Formatter, Result as FmtResult},
serde::{
de::{self, Deserialize, Deserializer, MapAccess, SeqAccess, Visitor},
ser::{Serialize, SerializeStruct, Serializer},
},
use crate::{
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
};
use core::fmt::{Formatter, Result as FmtResult};
use serde::{
de::{self, Deserialize, Deserializer, MapAccess, SeqAccess, Visitor},
ser::{Serialize, SerializeStruct, Serializer},
};
macro_rules! serde_fixed {

View File

@ -18,10 +18,9 @@ This module provides type aliases for all supported fixed-point
numbers.
*/
use crate::frac;
use crate::{
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
FixedU8,
frac, FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32,
FixedU64, FixedU8,
};
/*