Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve grammar in documentation of format strings #80601

Merged
merged 1 commit into from
Jan 21, 2021

Conversation

steffahn
Copy link
Member

@steffahn steffahn commented Jan 1, 2021

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
(current docs: https://doc.rust-lang.org/nightly/std/fmt/#syntax)

@rustbot modify labels: T-doc

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cramertj (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 1, 2021
@rustbot rustbot added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Jan 1, 2021
@steffahn steffahn force-pushed the improve_format_string_grammar branch from eb022de to 2eb4ccd Compare January 1, 2021 22:07
@Volker-Weissmann
Copy link
Contributor

Volker-Weissmann commented Jan 2, 2021

I think you should mention that this is a EBNF dialekt, with [] * indicating repetition. Writing code in a formal language and not specifier the name of that language / providing a link to its specification seems bad to me.

Also, I think you are missing a text := ... line.

@m-ou-se
Copy link
Member

m-ou-se commented Jan 19, 2021

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 19, 2021

📌 Commit 2eb4ccd has been approved by m-ou-se

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 19, 2021
@m-ou-se m-ou-se assigned m-ou-se and unassigned cramertj Jan 19, 2021
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jan 20, 2021
…mar, r=m-ou-se

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
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jan 20, 2021
…mar, r=m-ou-se

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
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2021
Rollup of 11 pull requests

Successful merges:

 - rust-lang#79655 (Add Vec visualization to understand capacity)
 - rust-lang#80172 (Use consistent punctuation for 'Prelude contents' docs)
 - rust-lang#80429 (Add regression test for mutual recursion in obligation forest)
 - rust-lang#80601 (Improve grammar in documentation of format strings)
 - rust-lang#81046 (Improve unknown external crate error)
 - rust-lang#81178 (Visit only terminators when removing landing pads)
 - rust-lang#81179 (Fix broken links with `--document-private-items` in the standard library)
 - rust-lang#81184 (Remove unnecessary `after_run` function)
 - rust-lang#81185 (Fix ICE in mir when evaluating SizeOf on unsized type)
 - rust-lang#81187 (Fix typo in counters.rs)
 - rust-lang#81219 (Document security implications of std::env::temp_dir)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8be36b1 into rust-lang:master Jan 21, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 21, 2021
@steffahn steffahn deleted the improve_format_string_grammar branch May 20, 2021 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants