Skip to content

Utilize if..let instead of single match branch #31820

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
frewsxcv opened this issue Feb 22, 2016 · 9 comments
Closed

Utilize if..let instead of single match branch #31820

frewsxcv opened this issue Feb 22, 2016 · 9 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@frewsxcv
Copy link
Member

match cx.lltypes().borrow().get(&t) {
Some(&llty) => return llty,
None => ()
}

More info: https://doc.rust-lang.org/book/if-let.html

@eddyb
Copy link
Member

eddyb commented Feb 22, 2016

There are matches like this all over the place. I just replaced some of the ones in trans in a branch I'm working on atm.

@eddyb eddyb added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. C-cleanup Category: PRs that clean code up or issues documenting cleanup. labels Feb 22, 2016
@durka
Copy link
Contributor

durka commented Feb 22, 2016

Clippy's single_match lint should help finding them.

@nxnfufunezn
Copy link
Contributor

or maybe this would help

ag "match.+\n\s+Some.+\n\s+(None|_) => (\(\)|\{\})"

@dileepbapat
Copy link
Contributor

can I pick this up?

dileepbapat added a commit to dileepbapat/rust that referenced this issue Feb 23, 2016
@frewsxcv
Copy link
Member Author

@dileepbapat Go for it! Let us know if you need any help

@dileepbapat
Copy link
Contributor

@frewsxcv let me know if this is ok

@frewsxcv
Copy link
Member Author

@dileepbapat Looks good, nice job! Your changes are waiting in a queue to be merged:

http://buildbot.rust-lang.org/homu/queue/rust

Manishearth added a commit to Manishearth/rust that referenced this issue Feb 24, 2016
I have made changes and built it after that. Please advise,

rust-lang#31820
@durka
Copy link
Contributor

durka commented Feb 25, 2016

This can be closed now.

@frewsxcv
Copy link
Member Author

Thanks again @dileepbapat!

critiqjo pushed a commit to critiqjo/rustdoc that referenced this issue Dec 16, 2016
I have made changes and built it after that. Please advise,

rust-lang/rust#31820
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

5 participants