From 9036e87dd64dfc10ef9fecc84c16270b427b6786 Mon Sep 17 00:00:00 2001 From: Owen Brooks Date: Mon, 6 Jun 2022 18:32:41 +1000 Subject: [PATCH] Fix Point display to respect formatting parameters This changes Point formatting to match formatting of other geometry types, including Isometry, Scale, and Rotation. Fixes issue #1115 since it passes through the desired precision formatting parameter. --- src/geometry/point.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/geometry/point.rs b/src/geometry/point.rs index 306c18e5..1ccad408 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -458,16 +458,10 @@ where DefaultAllocator: Allocator, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{{")?; - - let mut it = self.coords.iter(); - - write!(f, "{}", *it.next().unwrap())?; - - for comp in it { - write!(f, ", {}", *comp)?; - } + let precision = f.precision().unwrap_or(3); + write!(f, "Point {{")?; + write!(f, "{:.*}", precision, self.coords)?; write!(f, "}}") } }