diff --git a/src/geometry/point.rs b/src/geometry/point.rs index 5ccb62791..11d88915a 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -511,12 +511,26 @@ where let mut it = self.coords.iter(); - write!(f, "{}", *it.next().unwrap())?; + ::fmt(it.next().unwrap(), f)?; for comp in it { - write!(f, ", {}", *comp)?; + write!(f, ", ")?; + ::fmt(comp, f)?; } write!(f, "}}") } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn display_fmt_respects_modifiers() { + let p = crate::Point3::new(1.23, 3.45, 5.67); + assert_eq!(&format!("{p}"), "{1.23, 3.45, 5.67}"); + assert_eq!(&format!("{p:.1}"), "{1.2, 3.5, 5.7}"); + assert_eq!(&format!("{p:.0}"), "{1, 3, 6}"); + } +}