-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rustdoc: Allow implicit fn main() -> Result<_, _>
#56260
Comments
Feels like a no-brainer to me; would be great. :) |
I think there are two things we want before doing this:
|
|
Yes, that's what I'm thinking, and I'm setting up a PR for that. However, it's still unstable. |
I talked about this back in March on the " That sample you gave isn't even valid as-is, unless |
That'll be next, hopefully. I wonder if it suffices to |
Modify doctest's auto-`fn main()` to allow `Result`s This lets the default `fn main()` ~~return `impl Termination`~~ unwrap Results, which allows the use of `?` in most tests without adding it manually. This fixes #56260 ~~Blocked on `std::process::Termination` stabilization.~~ Using `Termination` would have been cleaner, but this should work OK.
… r=GuillaumeGomez Modify doctest's auto-`fn main()` to allow `Result`s This lets the default `fn main()` ~~return `impl Termination`~~ unwrap Results, which allows the use of `?` in most tests without adding it manually. This fixes rust-lang#56260 ~~Blocked on `std::process::Termination` stabilization.~~ Using `Termination` would have been cleaner, but this should work OK.
… r=GuillaumeGomez Modify doctest's auto-`fn main()` to allow `Result`s This lets the default `fn main()` ~~return `impl Termination`~~ unwrap Results, which allows the use of `?` in most tests without adding it manually. This fixes rust-lang#56260 ~~Blocked on `std::process::Termination` stabilization.~~ Using `Termination` would have been cleaner, but this should work OK.
… r=GuillaumeGomez Modify doctest's auto-`fn main()` to allow `Result`s This lets the default `fn main()` ~~return `impl Termination`~~ unwrap Results, which allows the use of `?` in most tests without adding it manually. This fixes rust-lang#56260 ~~Blocked on `std::process::Termination` stabilization.~~ Using `Termination` would have been cleaner, but this should work OK.
Rustdoc now allows us to use
?
in our tests. Unfortunately, this requires writing thefn main() -> ..
manually, which really shouldn't be needed IMHO.So we now have to write:
where it should suffice to write:
Doing so will make the tests shorter and hopefully lead to more
?
and lessunwrap
in tests.The text was updated successfully, but these errors were encountered: