Skip to content

s/try!/?/g in documentation examples #38644

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

Closed
steveklabnik opened this issue Dec 28, 2016 · 7 comments
Closed

s/try!/?/g in documentation examples #38644

steveklabnik opened this issue Dec 28, 2016 · 7 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue.

Comments

@steveklabnik
Copy link
Member

Now that ? is stable, documentation should be updated to use it instead of try!. try!'s docs should probably have a once-over, as well.

PRs to do this in any amount will be welcome, even just one examples!

@steveklabnik steveklabnik added A-docs E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. labels Dec 28, 2016
@tshepang
Copy link
Member

am curious why the downvotes

@fhartwig
Copy link
Contributor

@tshepang I'm not convinced that indiscriminately replacing try! by ? is an improvement to the documentation. I like ? for avoiding nested try! expressions, but I don't see much value in changing simple expressions to use ?. Particularly in docs, I think it makes sense to favour the macro, as it is less easy to miss.

@josephpd3
Copy link

Sorry if I'm out of place in commenting as a total stranger in the Rust repo, but I'm down to help--though I can see why it's a bit on the fence for some.

I feel if the solution to this issue (either sticking to try or ? wholly or drawing the line that @fhartwig suggests) is in line with a practice to make doc examples more idiomatic. That has a sort of consistency in example I feel really builds to having more visually cohesive APIs--coming from Python myself, at least.

As I said, I would love to help if it is needed and will start on a PR, but I feel as if more discussion could only make a resolution more robust here.

@steveklabnik
Copy link
Member Author

@josephpd3 #38648 is already a PR, so I think we have it covered. Reviewing that would be helpful though!

@josephpd3
Copy link

@steveklabnik gotcha! Wasn't sure if those changes to libstd was the extent of the desired changes or just a part of them. I should've peeked at that PR more. I'll go check it out and help review as I'm able.

utkarshkukreti added a commit to utkarshkukreti/rust that referenced this issue Jan 22, 2017
bors added a commit that referenced this issue Jan 22, 2017
…tation-examples, r=pnkfelix,steveklabnik,frewsxcvx

libstd: replace all `try!` with `?` in documentation examples

See #38644.

For the record, I used the following Perl one-liner and then manually fixed a couple of things it got wrong:

    $ perl -p -i -e 's#(///.*)try!\((.*)\)#$1$2?#' src/libstd/**/*.rs
@mgattozzi
Copy link
Contributor

@steveklabnik did #38648 get them all or is this still open to get worked on?

@steveklabnik
Copy link
Member Author

I think this got all of them; if you find an example using try!, please send in a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue.
Projects
None yet
Development

No branches or pull requests

5 participants