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

Update rustdoc book to suggest using Termination trait instead of hidden ‘foo’ function #50721

Closed
frewsxcv opened this issue May 13, 2018 · 0 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. P-medium Medium priority

Comments

@frewsxcv
Copy link
Member

frewsxcv commented May 13, 2018

Towards the end of this section in the rustdoc book, we suggest wrapping functions that utilize ? with fn foo() -> io::Result<()> { .. }.

Now that the Termination trait has stabilized, we can recommend using that instead of this hidden foo function. For examples of what I mean, see this pull request.


@steveklabnik is happy to mentor anyone who wants to do this. Here's the basic outline of what needs to happen:

Here's the file that needs to be modified: https://github.com/rust-lang/rust/blob/master/src/doc/rustdoc/src/documentation-tests.md

The part that starts with:

Another case where the use of # is handy is when you want to ignore error handling. Lets say you want the following,

This should be moved into its own section, "Using ? in doc tests", and instead of wrapping it in a function, it should suggest something similar to the diff above.

If you have any questions about this, don't hesitate to ask in a comment below!

@frewsxcv frewsxcv added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label May 13, 2018
@steveklabnik steveklabnik added the P-medium Medium priority label May 14, 2018
@steveklabnik steveklabnik added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels May 28, 2018
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jun 5, 2018
…=steveklabnik

Update rustdoc book to suggest using Termination trait instead of hidden ‘foo’ function

Closes rust-lang#50721.

I suggest that someone double-checks my English since I am not a native speaker.

r? @steveklabnik
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 E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

2 participants