Skip to content

Commit a33d61a

Browse files
committed
Use code formatting for code-relevant values in std::fmt docs
Especially when documenting the use of `0`, since zero looks very similar to `O` in fonts not meant for displaying code. Other literal characters, traits, etc should also use code formatting. This change makes this documentation more internally consistent.
1 parent 6108e8c commit a33d61a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/libcollections/fmt.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
//! }
219219
//! ```
220220
//!
221-
//! ### fmt::Display vs fmt::Debug
221+
//! ### `fmt::Display` vs `fmt::Debug`
222222
//!
223223
//! These two formatting traits have distinct purposes:
224224
//!
@@ -358,24 +358,24 @@
358358
//! to ensure padding is applied is to format your input, then use this
359359
//! resulting string to pad your output.
360360
//!
361-
//! ## Sign/#/0
361+
//! ## Sign/`#`/`0`
362362
//!
363363
//! These can all be interpreted as flags for a particular formatter.
364364
//!
365-
//! * '+' - This is intended for numeric types and indicates that the sign
365+
//! * `+` - This is intended for numeric types and indicates that the sign
366366
//! should always be printed. Positive signs are never printed by
367367
//! default, and the negative sign is only printed by default for the
368-
//! `Signed` trait. This flag indicates that the correct sign (+ or -)
368+
//! `Signed` trait. This flag indicates that the correct sign (`+` or `-`)
369369
//! should always be printed.
370-
//! * '-' - Currently not used
371-
//! * '#' - This flag is indicates that the "alternate" form of printing should
370+
//! * `-` - Currently not used
371+
//! * `#` - This flag is indicates that the "alternate" form of printing should
372372
//! be used. The alternate forms are:
373373
//! * `#?` - pretty-print the `Debug` formatting
374-
//! * `#x` - precedes the argument with a "0x"
375-
//! * `#X` - precedes the argument with a "0x"
376-
//! * `#b` - precedes the argument with a "0b"
377-
//! * `#o` - precedes the argument with a "0o"
378-
//! * '0' - This is used to indicate for integer formats that the padding should
374+
//! * `#x` - precedes the argument with a `0x`
375+
//! * `#X` - precedes the argument with a `0x`
376+
//! * `#b` - precedes the argument with a `0b`
377+
//! * `#o` - precedes the argument with a `0o`
378+
//! * `0` - This is used to indicate for integer formats that the padding should
379379
//! both be done with a `0` character as well as be sign-aware. A format
380380
//! like `{:08}` would yield `00000001` for the integer `1`, while the
381381
//! same format would yield `-0000001` for the integer `-1`. Notice that
@@ -390,8 +390,8 @@
390390
//!
391391
//! The default fill/alignment for non-numerics is a space and left-aligned. The
392392
//! defaults for numeric formatters is also a space but with right-alignment. If
393-
//! the '0' flag is specified for numerics, then the implicit fill character is
394-
//! '0'.
393+
//! the `0` flag is specified for numerics, then the implicit fill character is
394+
//! `0`.
395395
//!
396396
//! The value for the width can also be provided as a `usize` in the list of
397397
//! parameters by using the `2$` syntax indicating that the second argument is a

0 commit comments

Comments
 (0)