Skip to content

Commit

Permalink
Correct misleading std::fmt::Binary example
Browse files Browse the repository at this point in the history
  • Loading branch information
Colonial-Dev committed Oct 2, 2023
1 parent e0d7ed1 commit f2ecf7c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions library/core/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,10 @@ pub trait Octal {
/// assert_eq!(format!("l as binary is: {l:b}"), "l as binary is: 1101011");
///
/// assert_eq!(
/// format!("l as binary is: {l:#032b}"),
/// "l as binary is: 0b000000000000000000000001101011"
/// // Note that the `0b` prefix added by `#` is included in the total width, so we
/// // need to add two to correctly display all 32 bits.
/// format!("l as binary is: {l:#034b}"),
/// "l as binary is: 0b00000000000000000000000001101011"
/// );
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down

0 comments on commit f2ecf7c

Please sign in to comment.