diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-04-14 09:01:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-14 09:01:58 +0200 |
| commit | 2bec57d4a9405b256ec10d524fd917823a68049d (patch) | |
| tree | 7016c941160b40e3e933d503149d3f09603a4c44 | |
| parent | 0638780570fdc6a0358c77e9708ba2f160e1f364 (diff) | |
| parent | fa21dd4a97af4c78f9f24b52d22174563a74a335 (diff) | |
| download | rust-2bec57d4a9405b256ec10d524fd917823a68049d.tar.gz rust-2bec57d4a9405b256ec10d524fd917823a68049d.zip | |
Rollup merge of #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`.
| -rw-r--r-- | library/core/src/fmt/mod.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index a0de748b5e1..ce0643a3f5e 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -860,10 +860,10 @@ pub trait Binary { /// Basic usage with `i32`: /// /// ``` -/// let x = 42; // 42 is '2a' in hex +/// let y = 42; // 42 is '2a' in hex /// -/// assert_eq!(format!("{x:x}"), "2a"); -/// assert_eq!(format!("{x:#x}"), "0x2a"); +/// assert_eq!(format!("{y:x}"), "2a"); +/// assert_eq!(format!("{y:#x}"), "0x2a"); /// /// assert_eq!(format!("{:x}", -16), "fffffff0"); /// ``` @@ -915,10 +915,10 @@ pub trait LowerHex { /// Basic usage with `i32`: /// /// ``` -/// let x = 42; // 42 is '2A' in hex +/// let y = 42; // 42 is '2A' in hex /// -/// assert_eq!(format!("{x:X}"), "2A"); -/// assert_eq!(format!("{x:#X}"), "0x2A"); +/// assert_eq!(format!("{y:X}"), "2A"); +/// assert_eq!(format!("{y:#X}"), "0x2A"); /// /// assert_eq!(format!("{:X}", -16), "FFFFFFF0"); /// ``` |
