diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-16 15:08:03 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-16 15:08:03 +0100 |
| commit | 51efb0f4d69943e290d977673970cd3c8ada306f (patch) | |
| tree | 6478ba698749eec120755e283adf7932a6a98d2f /src/geom | |
| parent | d763f0f5a6a700352ee8926c15c8e58624f705c9 (diff) | |
Port remaining parser tests 🚚
Diffstat (limited to 'src/geom')
| -rw-r--r-- | src/geom/length.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/geom/length.rs b/src/geom/length.rs index 00803e13..1a45c63c 100644 --- a/src/geom/length.rs +++ b/src/geom/length.rs @@ -99,10 +99,12 @@ impl Length { impl Display for Length { fn fmt(&self, f: &mut Formatter) -> fmt::Result { + use LengthUnit::*; + // Format with the unit that yields the shortest output, preferring - // larger units when tied. + // larger / metrics units when tied. let mut buf = ryu::Buffer::new(); - let unit = [LengthUnit::Cm, LengthUnit::Mm, LengthUnit::Pt] + let unit = [Cm, Mm, In, Pt] .iter() .copied() .min_by_key(|&unit| buf.format(self.to_unit(unit)).len()) |
