Description
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!