From c38b4b601da4ae3c9c13b05fc5161035d850551e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 16 Apr 2019 14:30:46 -0700 Subject: [PATCH 1/2] cargo fmt --- src/lib.rs | 34 ++++++++-------------------------- src/sign.rs | 6 +----- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5a25bab..172e714 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,13 +90,12 @@ pub trait NumOps: { } -impl NumOps for T -where +impl NumOps for T where T: Add + Sub + Mul + Div - + Rem, + + Rem { } @@ -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 NumRef for T -where - T: Num + for<'r> NumOps<&'r T>, -{ -} +impl 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: NumOps + for<'r> NumOps<&'r Base, Base> {} -impl RefNum for T -where - T: NumOps + for<'r> NumOps<&'r Base, Base>, -{ -} +impl RefNum for T where T: NumOps + for<'r> NumOps<&'r Base, Base> {} /// The trait for types implementing numeric assignment operators (like `+=`). /// @@ -130,9 +121,8 @@ pub trait NumAssignOps: { } -impl NumAssignOps for T -where - T: AddAssign + SubAssign + MulAssign + DivAssign + RemAssign, +impl NumAssignOps for T where + T: AddAssign + SubAssign + MulAssign + DivAssign + RemAssign { } @@ -140,22 +130,14 @@ where /// /// This is automatically implemented for types which implement the operators. pub trait NumAssign: Num + NumAssignOps {} -impl NumAssign for T -where - T: Num + NumAssignOps, -{ -} +impl 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 NumAssignRef for T -where - T: NumAssign + for<'r> NumAssignOps<&'r T>, -{ -} +impl NumAssignRef for T where T: NumAssign + for<'r> NumAssignOps<&'r T> {} macro_rules! int_trait_impl { ($name:ident for $($t:ty)*) => ($( diff --git a/src/sign.rs b/src/sign.rs index cb1d9fb..26d44c5 100644 --- a/src/sign.rs +++ b/src/sign.rs @@ -206,11 +206,7 @@ empty_trait_impl!(Unsigned for usize u8 u16 u32 u64); #[cfg(has_i128)] empty_trait_impl!(Unsigned for u128); -impl Unsigned for Wrapping -where - Wrapping: Num, -{ -} +impl Unsigned for Wrapping where Wrapping: Num {} #[test] fn unsigned_wrapping_is_unsigned() { From a1688f69912c357a882f1aea1ca84afb932a7b3c Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 16 Apr 2019 14:32:21 -0700 Subject: [PATCH 2/2] Check formatting in CI --- .travis.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6c498f4..4c8c375 100644 --- a/.travis.yml +++ b/.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