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

Change all r#try! to ? #33

Closed
jasonwilliams opened this issue Jun 28, 2019 · 1 comment · Fixed by #37
Closed

Change all r#try! to ? #33

jasonwilliams opened this issue Jun 28, 2019 · 1 comment · Fixed by #37
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jasonwilliams
Copy link
Member

jasonwilliams commented Jun 28, 2019

Rust 2018 edition removed the need for the try macro, functions which return an Option/Result can be used with the ? operator.

More info here:
https://doc.rust-lang.org/stable/edition-guide/rust-2018/error-handling-and-panics/the-question-mark-operator-for-easier-error-handling.html

Book:
https://doc.rust-lang.org/beta/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator

Boa still has try! all over the place for e.g https://github.com/jasonwilliams/boa/blob/master/src/lib/js/value.rs#L507

These could be converted to use the ? operator instead. e.g https://github.com/jasonwilliams/boa/blob/master/src/lib/syntax/lexer.rs#L219

@jasonwilliams jasonwilliams added help wanted Extra attention is needed good first issue Good for newcomers labels Jun 28, 2019
@Atul9
Copy link
Contributor

Atul9 commented Jun 29, 2019

Hi @jasonwilliams I would like to take this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants