Small syntax change in 03_factorial
This commit is contained in:
@@ -5,9 +5,7 @@ use num_traits::identities::One;
|
|||||||
fn fact<T: PartialOrd + PartialEq + One + Sub<Output = T> + Copy + Display>(x: T) -> T {
|
fn fact<T: PartialOrd + PartialEq + One + Sub<Output = T> + Copy + Display>(x: T) -> T {
|
||||||
if x < T::one() {
|
if x < T::one() {
|
||||||
panic!("Invalid number: {}", x);
|
panic!("Invalid number: {}", x);
|
||||||
}
|
} else if x.is_one() {
|
||||||
|
|
||||||
if x.is_one() {
|
|
||||||
return T::one();
|
return T::one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user