diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-02-17 12:14:50 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-02-17 12:14:50 +0100 |
| commit | c7a9bac99224af9673f26ec140af48e1728fe3b5 (patch) | |
| tree | c7611385e8f0245b69e1e8cb24d36d2689808528 /src/geom/angle.rs | |
| parent | ab95627d873239182e7b28b266f8b9f9da5cdbb1 (diff) | |
Better debug implementations for numeric types
Diffstat (limited to 'src/geom/angle.rs')
| -rw-r--r-- | src/geom/angle.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/geom/angle.rs b/src/geom/angle.rs index df2aca17..acf3803d 100644 --- a/src/geom/angle.rs +++ b/src/geom/angle.rs @@ -58,15 +58,7 @@ impl Angle { impl Debug for Angle { fn fmt(&self, f: &mut Formatter) -> fmt::Result { - // Format with the unit that yields the shortest output, preferring - // degrees when tied. - let unit = [AngularUnit::Deg, AngularUnit::Rad] - .iter() - .copied() - .min_by_key(|&unit| self.to_unit(unit).to_string().len()) - .unwrap(); - - write!(f, "{}{:?}", self.to_unit(unit), unit) + write!(f, "{}deg", round_2(self.to_deg())) } } |
