1
1
use crate :: fraction:: Sign ;
2
2
use crate :: {
3
- display, Bounded , CheckedAdd , CheckedDiv , CheckedMul , CheckedSub , ConstOne , ConstZero , FromPrimitive , Integer , Num ,
4
- One , ParseRatioError , Ratio , Signed , ToPrimitive , Zero ,
3
+ display, Bounded , CheckedAdd , CheckedDiv , CheckedMul , CheckedSub , ConstOne , ConstZero ,
4
+ FromPrimitive , Integer , Num , One , ParseRatioError , Ratio , Signed , ToPrimitive , Zero ,
5
5
} ;
6
6
#[ cfg( feature = "with-bigint" ) ]
7
7
use crate :: { BigInt , BigUint } ;
@@ -595,7 +595,8 @@ impl<T: Clone + Integer> Zero for GenericFraction<T> {
595
595
}
596
596
597
597
impl < T : ConstOne + ConstZero + Integer + Clone > ConstZero for GenericFraction < T > {
598
- const ZERO : GenericFraction < T > = GenericFraction :: Rational ( Sign :: Plus , Ratio :: new_raw ( ConstZero :: ZERO , ConstOne :: ONE ) ) ;
598
+ const ZERO : GenericFraction < T > =
599
+ GenericFraction :: Rational ( Sign :: Plus , Ratio :: new_raw ( ConstZero :: ZERO , ConstOne :: ONE ) ) ;
599
600
}
600
601
601
602
impl < T : Clone + Integer > One for GenericFraction < T > {
@@ -605,7 +606,8 @@ impl<T: Clone + Integer> One for GenericFraction<T> {
605
606
}
606
607
607
608
impl < T : ConstOne + Integer + Clone > ConstOne for GenericFraction < T > {
608
- const ONE : GenericFraction < T > = GenericFraction :: Rational ( Sign :: Plus , Ratio :: new_raw ( ConstOne :: ONE , ConstOne :: ONE ) ) ;
609
+ const ONE : GenericFraction < T > =
610
+ GenericFraction :: Rational ( Sign :: Plus , Ratio :: new_raw ( ConstOne :: ONE , ConstOne :: ONE ) ) ;
609
611
}
610
612
611
613
impl < T : Clone + Integer > Num for GenericFraction < T > {
@@ -1264,7 +1266,10 @@ mod tests {
1264
1266
#[ cfg( feature = "with-bigint" ) ]
1265
1267
use crate :: { BigInt , BigUint } ;
1266
1268
1267
- use crate :: { Bounded , ConstOne , ConstZero , Fraction , GenericFraction , Num , One , Sign , Signed , ToPrimitive , Zero } ;
1269
+ use crate :: {
1270
+ Bounded , ConstOne , ConstZero , Fraction , GenericFraction , Num , One , Sign , Signed ,
1271
+ ToPrimitive , Zero ,
1272
+ } ;
1268
1273
1269
1274
use super :: { CheckedAdd , CheckedDiv , CheckedMul , CheckedSub } ;
1270
1275
@@ -2715,14 +2720,14 @@ mod tests {
2715
2720
let one = Frac :: one ( ) ;
2716
2721
assert_eq ! ( constant_one, one) ;
2717
2722
}
2718
-
2723
+
2719
2724
#[ test]
2720
2725
fn constant_zero ( ) {
2721
2726
let constant_zero = <Frac as ConstZero >:: ZERO ;
2722
2727
let zero = Frac :: zero ( ) ;
2723
2728
assert_eq ! ( constant_zero, zero) ;
2724
2729
}
2725
-
2730
+
2726
2731
#[ test]
2727
2732
fn consistency_partial_cmp ( ) {
2728
2733
let nan = Frac :: nan ( ) ;
0 commit comments