@@ -455,7 +455,10 @@ impl Display for Arguments<'_> {
455455///
456456/// impl fmt::Debug for Point {
457457/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
458- /// write!(f, "Point {{ x: {}, y: {} }}", self.x, self.y)
458+ /// f.debug_struct("Point")
459+ /// .field("x", &self.x)
460+ /// .field("y", &self.y)
461+ /// .finish()
459462/// }
460463/// }
461464///
@@ -528,7 +531,10 @@ pub trait Debug {
528531 ///
529532 /// impl fmt::Debug for Position {
530533 /// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
531- /// write!(f, "({:?}, {:?})", self.longitude, self.latitude)
534+ /// f.debug_tuple("")
535+ /// .field(&self.longitude)
536+ /// .field(&self.latitude)
537+ /// .finish()
532538 /// }
533539 /// }
534540 ///
@@ -912,8 +918,8 @@ pub trait Pointer {
912918///
913919/// impl fmt::LowerExp for Length {
914920/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
915- /// let val = self.0;
916- /// write!(f, "{}e1", val / 10)
921+ /// let val = f64::from( self.0) ;
922+ /// fmt::LowerExp::fmt(&val, f) // delegate to f64's implementation
917923/// }
918924/// }
919925///
@@ -955,8 +961,8 @@ pub trait LowerExp {
955961///
956962/// impl fmt::UpperExp for Length {
957963/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
958- /// let val = self.0;
959- /// write!(f, "{}E1", val / 10)
964+ /// let val = f64::from( self.0) ;
965+ /// fmt::UpperExp::fmt(&val, f) // delegate to f64's implementation
960966/// }
961967/// }
962968///
0 commit comments