Skip to content

Commit 9d009c0

Browse files
committed
Auto merge of #28723 - carols10cents:0-or-O-or-o, r=steveklabnik
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. Before this change, circled is the character I was using this documentation to find out about and that confused me when it wasn't immediately clear what character it was: <img width="1013" alt="screen shot 2015-09-28 at 10 13 31 pm" src="https://cloud.githubusercontent.com/assets/193874/10154708/c70815fe-6638-11e5-9acc-57c73a524203.png"> After this change: <img width="981" alt="screen shot 2015-09-28 at 11 26 35 pm" src="https://cloud.githubusercontent.com/assets/193874/10154710/ce73eeb2-6638-11e5-98f7-902f58679316.png"> I ran `make check-docs` and didn't break anything ⭐
2 parents abfbea2 + a33d61a commit 9d009c0

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)