Skip to content

Rename Parser::try, since try is a keyword now #243

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
RazrFalcon opened this issue Apr 8, 2019 · 5 comments
Closed

Rename Parser::try, since try is a keyword now #243

RazrFalcon opened this issue Apr 8, 2019 · 5 comments

Comments

@RazrFalcon
Copy link

error: expected identifier, found reserved keyword `try`
   --> src/lib.rs:494:30
    |
494 |             important: input.try(cssparser::parse_important).is_ok(),
    |                              ^^^ expected identifier, found reserved keyword
help: you can escape reserved keywords to use them as identifiers
    |
494 |             important: input.r#try(cssparser::parse_important).is_ok(),
    |                              ^^^^^

@SimonSapin
Copy link
Member

I’d rather add a method with another name that does the same thing and keep try. Do you have a suggestion for the new name?

@RazrFalcon
Copy link
Author

try_parse?

@emilio
Copy link
Member

emilio commented Apr 9, 2019

Last time we discussed this @nox proposed just try_. I prefer that to longer names.

SimonSapin added a commit that referenced this issue Apr 10, 2019
bors-servo pushed a commit that referenced this issue Apr 10, 2019
Add Parser::try_parse, same as Parser::try

Fixes #243

Note that we are not (so far) emitting deprecation warnings for the old name.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/244)
<!-- Reviewable:end -->
@SimonSapin
Copy link
Member

Oh sorry @emilio, I missed your comment before making the PR.

@emilio
Copy link
Member

emilio commented Apr 10, 2019

It doesn't really matter. We can always add yet another method :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants