Merge #110
110: Check formatting in CI r=cuviper a=cuviper Co-authored-by: Josh Stone <cuviper@gmail.com>
This commit is contained in:
commit
38655c91c1
12
.travis.yml
12
.travis.yml
|
@ -1,15 +1,25 @@
|
|||
language: rust
|
||||
sudo: false
|
||||
rust:
|
||||
- 1.8.0
|
||||
- 1.15.0
|
||||
- 1.20.0
|
||||
- 1.26.0 # has_i128
|
||||
- 1.31.0 # 2018!
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
sudo: false
|
||||
script:
|
||||
- cargo build --verbose
|
||||
- ./ci/test_full.sh
|
||||
matrix:
|
||||
include:
|
||||
- name: "rustfmt"
|
||||
rust: 1.31.0
|
||||
before_script:
|
||||
- rustup component add rustfmt
|
||||
script:
|
||||
- cargo fmt --all -- --check
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
|
|
34
src/lib.rs
34
src/lib.rs
|
@ -90,13 +90,12 @@ pub trait NumOps<Rhs = Self, Output = Self>:
|
|||
{
|
||||
}
|
||||
|
||||
impl<T, Rhs, Output> NumOps<Rhs, Output> for T
|
||||
where
|
||||
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
|
||||
T: Add<Rhs, Output = Output>
|
||||
+ Sub<Rhs, Output = Output>
|
||||
+ Mul<Rhs, Output = Output>
|
||||
+ Div<Rhs, Output = Output>
|
||||
+ Rem<Rhs, Output = Output>,
|
||||
+ Rem<Rhs, Output = Output>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -105,22 +104,14 @@ where
|
|||
///
|
||||
/// This is automatically implemented for types which implement the operators.
|
||||
pub trait NumRef: Num + for<'r> NumOps<&'r Self> {}
|
||||
impl<T> NumRef for T
|
||||
where
|
||||
T: Num + for<'r> NumOps<&'r T>,
|
||||
{
|
||||
}
|
||||
impl<T> NumRef for T where T: Num + for<'r> NumOps<&'r T> {}
|
||||
|
||||
/// The trait for references which implement numeric operations, taking the
|
||||
/// second operand either by value or by reference.
|
||||
///
|
||||
/// This is automatically implemented for types which implement the operators.
|
||||
pub trait RefNum<Base>: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base> {}
|
||||
impl<T, Base> RefNum<Base> for T
|
||||
where
|
||||
T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,
|
||||
{
|
||||
}
|
||||
impl<T, Base> RefNum<Base> for T where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base> {}
|
||||
|
||||
/// The trait for types implementing numeric assignment operators (like `+=`).
|
||||
///
|
||||
|
@ -130,9 +121,8 @@ pub trait NumAssignOps<Rhs = Self>:
|
|||
{
|
||||
}
|
||||
|
||||
impl<T, Rhs> NumAssignOps<Rhs> for T
|
||||
where
|
||||
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
|
||||
impl<T, Rhs> NumAssignOps<Rhs> for T where
|
||||
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -140,22 +130,14 @@ where
|
|||
///
|
||||
/// This is automatically implemented for types which implement the operators.
|
||||
pub trait NumAssign: Num + NumAssignOps {}
|
||||
impl<T> NumAssign for T
|
||||
where
|
||||
T: Num + NumAssignOps,
|
||||
{
|
||||
}
|
||||
impl<T> NumAssign for T where T: Num + NumAssignOps {}
|
||||
|
||||
/// The trait for `NumAssign` types which also implement assignment operations
|
||||
/// taking the second operand by reference.
|
||||
///
|
||||
/// This is automatically implemented for types which implement the operators.
|
||||
pub trait NumAssignRef: NumAssign + for<'r> NumAssignOps<&'r Self> {}
|
||||
impl<T> NumAssignRef for T
|
||||
where
|
||||
T: NumAssign + for<'r> NumAssignOps<&'r T>,
|
||||
{
|
||||
}
|
||||
impl<T> NumAssignRef for T where T: NumAssign + for<'r> NumAssignOps<&'r T> {}
|
||||
|
||||
macro_rules! int_trait_impl {
|
||||
($name:ident for $($t:ty)*) => ($(
|
||||
|
|
|
@ -206,11 +206,7 @@ empty_trait_impl!(Unsigned for usize u8 u16 u32 u64);
|
|||
#[cfg(has_i128)]
|
||||
empty_trait_impl!(Unsigned for u128);
|
||||
|
||||
impl<T: Unsigned> Unsigned for Wrapping<T>
|
||||
where
|
||||
Wrapping<T>: Num,
|
||||
{
|
||||
}
|
||||
impl<T: Unsigned> Unsigned for Wrapping<T> where Wrapping<T>: Num {}
|
||||
|
||||
#[test]
|
||||
fn unsigned_wrapping_is_unsigned() {
|
||||
|
|
Loading…
Reference in New Issue