Skip to content

Commit b668458

Browse files
authored
Rollup merge of rust-lang#123875 - Ghamza-Jd:master, r=joboet
Doc: replace x with y for hexa-decimal fmt I found it a bit unintuitive to know which is variable and which is the format string in `format!("{x:x}")`, so I switched it to `y`.
2 parents 20551db + 99e9da1 commit b668458

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: core/src/fmt/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,10 @@ pub trait Binary {
860860
/// Basic usage with `i32`:
861861
///
862862
/// ```
863-
/// let x = 42; // 42 is '2a' in hex
863+
/// let y = 42; // 42 is '2a' in hex
864864
///
865-
/// assert_eq!(format!("{x:x}"), "2a");
866-
/// assert_eq!(format!("{x:#x}"), "0x2a");
865+
/// assert_eq!(format!("{y:x}"), "2a");
866+
/// assert_eq!(format!("{y:#x}"), "0x2a");
867867
///
868868
/// assert_eq!(format!("{:x}", -16), "fffffff0");
869869
/// ```
@@ -915,10 +915,10 @@ pub trait LowerHex {
915915
/// Basic usage with `i32`:
916916
///
917917
/// ```
918-
/// let x = 42; // 42 is '2A' in hex
918+
/// let y = 42; // 42 is '2A' in hex
919919
///
920-
/// assert_eq!(format!("{x:X}"), "2A");
921-
/// assert_eq!(format!("{x:#X}"), "0x2A");
920+
/// assert_eq!(format!("{y:X}"), "2A");
921+
/// assert_eq!(format!("{y:#X}"), "0x2A");
922922
///
923923
/// assert_eq!(format!("{:X}", -16), "FFFFFFF0");
924924
/// ```

0 commit comments

Comments
 (0)