@@ -455,7 +455,10 @@ impl Display for Arguments<'_> {
455
455
///
456
456
/// impl fmt::Debug for Point {
457
457
/// 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()
459
462
/// }
460
463
/// }
461
464
///
@@ -528,7 +531,10 @@ pub trait Debug {
528
531
///
529
532
/// impl fmt::Debug for Position {
530
533
/// 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()
532
538
/// }
533
539
/// }
534
540
///
@@ -912,8 +918,8 @@ pub trait Pointer {
912
918
///
913
919
/// impl fmt::LowerExp for Length {
914
920
/// 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
917
923
/// }
918
924
/// }
919
925
///
@@ -955,8 +961,8 @@ pub trait LowerExp {
955
961
///
956
962
/// impl fmt::UpperExp for Length {
957
963
/// 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
960
966
/// }
961
967
/// }
962
968
///
0 commit comments