diff options
| author | Frank Steffahn <frank.steffahn@stu.uni-kiel.de> | 2021-01-01 22:53:34 +0100 |
|---|---|---|
| committer | Frank Steffahn <frank.steffahn@stu.uni-kiel.de> | 2021-01-01 23:07:35 +0100 |
| commit | 2eb4ccd3199f085b5863f85be11e552058ddaa24 (patch) | |
| tree | 185959f19ce548c7b8a223080288a05b73f28fd2 | |
| parent | 206ee1eea3467fd1d7f1efdbeafe27880897bb2c (diff) | |
| download | rust-2eb4ccd3199f085b5863f85be11e552058ddaa24.tar.gz rust-2eb4ccd3199f085b5863f85be11e552058ddaa24.zip | |
Improve grammar in documentation of format strings
| -rw-r--r-- | library/alloc/src/fmt.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs index 5ebc4d6c4c1..f9424b1d747 100644 --- a/library/alloc/src/fmt.rs +++ b/library/alloc/src/fmt.rs @@ -282,21 +282,22 @@ //! `%`. The actual grammar for the formatting syntax is: //! //! ```text -//! format_string := <text> [ maybe-format <text> ] * -//! maybe-format := '{' '{' | '}' '}' | <format> +//! format_string := text [ maybe_format text ] * +//! maybe_format := '{' '{' | '}' '}' | format //! format := '{' [ argument ] [ ':' format_spec ] '}' //! argument := integer | identifier //! -//! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision][type] +//! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision]type //! fill := character //! align := '<' | '^' | '>' //! sign := '+' | '-' //! width := count //! precision := count | '*' -//! type := identifier | '?' | '' +//! type := '' | '?' | 'x?' | 'X?' | identifier //! count := parameter | integer //! parameter := argument '$' //! ``` +//! In the above grammar, `text` may not contain any `'{'` or `'}'` characters. //! //! # Formatting traits //! |
