Skip to content

Commit

Permalink
Fix docs for formatting delegations
Browse files Browse the repository at this point in the history
  • Loading branch information
elichai committed Dec 4, 2019
1 parent 5f1d6c4 commit 8be7223
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ pub trait Display {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let val = self.0;
///
/// write!(f, "{:o}", val) // delegate to i32's implementation
/// fmt::Octal::fmt(&val, f) // delegate to i32's implementation
/// }
/// }
///
Expand Down Expand Up @@ -712,7 +712,7 @@ pub trait Octal {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let val = self.0;
///
/// write!(f, "{:b}", val) // delegate to i32's implementation
/// fmt::Binary::fmt(&val, f) // delegate to i32's implementation
/// }
/// }
///
Expand Down Expand Up @@ -771,7 +771,7 @@ pub trait Binary {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let val = self.0;
///
/// write!(f, "{:x}", val) // delegate to i32's implementation
/// fmt::LowerHex::fmt(&val, f) // delegate to i32's implementation
/// }
/// }
///
Expand Down Expand Up @@ -824,7 +824,7 @@ pub trait LowerHex {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let val = self.0;
///
/// write!(f, "{:X}", val) // delegate to i32's implementation
/// fmt::UpperHex::fmt(&val, f) // delegate to i32's implementation
/// }
/// }
///
Expand Down Expand Up @@ -869,7 +869,8 @@ pub trait UpperHex {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// // use `as` to convert to a `*const T`, which implements Pointer, which we can use
///
/// write!(f, "{:p}", self as *const Length)
/// let ptr = self as *const Self;
/// fmt::Pointer::fmt(&ptr, f)
/// }
/// }
///
Expand Down

0 comments on commit 8be7223

Please sign in to comment.