about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-02-11 08:25:41 +0100
committerGitHub <noreply@github.com>2024-02-11 08:25:41 +0100
commitf4e6818bfff639dacdabc1d959577c996e8d53a9 (patch)
tree202d425540650ff3f52abea374f12feb3a8fdfd7 /library/alloc/src
parent9aa232ecc7bb006a1fad404f437b049482021a3a (diff)
parent19caba0008895949e5db85202703958deb55dcdc (diff)
downloadrust-f4e6818bfff639dacdabc1d959577c996e8d53a9.tar.gz
rust-f4e6818bfff639dacdabc1d959577c996e8d53a9.zip
Rollup merge of #117740 - majaha:format_docs, r=joshtriplett
Add some links and minor explanatory comments to `std::fmt`

I thought the documentation for the `#` flag could do with a link to the explanation of the `?xXbo` flags, because at that point they haven't been explained yet and it's a bit confusing.

I also added that the `0` flag overrides the fill character and alignment flag, here's a [Rust Playgrond](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0d580b7b78b8a2d8c08a2fc7a936ef17) that shows what I mean.
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/fmt.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs
index 5b50ef7bf6c..fce2585cbf5 100644
--- a/library/alloc/src/fmt.rs
+++ b/library/alloc/src/fmt.rs
@@ -188,6 +188,10 @@
 //!     * `#X` - precedes the argument with a `0x`
 //!     * `#b` - precedes the argument with a `0b`
 //!     * `#o` - precedes the argument with a `0o`
+//!
+//!   See [Formatting traits](#formatting-traits) for a description of what the `?`, `x`, `X`,
+//!   `b`, and `o` flags do.
+//!
 //! * `0` - This is used to indicate for integer formats that the padding to `width` should
 //!         both be done with a `0` character as well as be sign-aware. A format
 //!         like `{:08}` would yield `00000001` for the integer `1`, while the
@@ -197,6 +201,7 @@
 //!         and before the digits. When used together with the `#` flag, a similar
 //!         rule applies: padding zeros are inserted after the prefix but before
 //!         the digits. The prefix is included in the total width.
+//!         This flag overrides the [fill character and alignment flag](#fillalignment).
 //!
 //! ## Precision
 //!