]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #80601 - steffahn:improve_format_string_grammar, r=m-ou-se
authorYuki Okushi <huyuumi.dev@gmail.com>
Thu, 21 Jan 2021 11:04:43 +0000 (20:04 +0900)
committerGitHub <noreply@github.com>
Thu, 21 Jan 2021 11:04:43 +0000 (20:04 +0900)
Improve grammar in documentation of format strings

The docs previously were
* using some weird `<` and `>` around some nonterminals
  * _correct me if these **did** have any meaning_
* using of a (not explicitly defined) `text` nonterminal that didn’t explicitly disallow productions containing `'{'` or `'}'`
* incorrect in not allowing for `x?` and `X?` productions of `type`
* unnecessarily ambiguous, both
  * allowing `type` to be `''`, and
  * using an optional `[type]`
* using inconsistent underscore/hyphenation style between `format_string` and `format_spec` vs `maybe-format`

_Rendered:_
![Screenshot_20210101_230901](https://user-images.githubusercontent.com/3986214/103447038-69d7a180-4c86-11eb-8fa0-0a6160a7ff7a.png)
_(current docs: https://doc.rust-lang.org/nightly/std/fmt/#syntax)_

```@rustbot``` modify labels: T-doc


Trivial merge