fix: Display
This commit is contained in:
@@ -161,7 +161,7 @@ impl ops::Neg for Fraction {
|
|||||||
|
|
||||||
impl fmt::Display for Fraction {
|
impl fmt::Display for Fraction {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
if self.num == 1 {
|
if self.den == 1 {
|
||||||
return write!(f, "{0}", self.num);
|
return write!(f, "{0}", self.num);
|
||||||
} else {
|
} else {
|
||||||
return write!(f, "{0}/{1}", self.num, self.den);
|
return write!(f, "{0}/{1}", self.num, self.den);
|
||||||
|
|||||||
Reference in New Issue
Block a user