Skip to content

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

Closed

Description

@frewsxcv

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

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

Activity

  1. eddyb commented on Feb 22, 2016

    @eddyb
    Contributor

    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.

  2. added
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.
    on Feb 22, 2016
  3. durka commented on Feb 22, 2016

    @durka
    Contributor

    Clippy's single_match lint should help finding them.

  4. nxnfufunezn commented on Feb 22, 2016

    @nxnfufunezn
    Contributor

    or maybe this would help

    ag "match.+\n\s+Some.+\n\s+(None|_) => (\(\)|\{\})"
  5. dileepbapat commented on Feb 23, 2016

    @dileepbapat
    Contributor

    can I pick this up?

  6. added a commit that references this issue on Feb 23, 2016
  7. frewsxcv commented on Feb 23, 2016

    @frewsxcv
    ContributorAuthor

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

  8. dileepbapat commented on Feb 24, 2016

    @dileepbapat
    Contributor

    @frewsxcv let me know if this is ok

  9. frewsxcv commented on Feb 24, 2016

    @frewsxcv
    ContributorAuthor

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

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

  10. added a commit that references this issue on Feb 24, 2016
  11. durka commented on Feb 25, 2016

    @durka
    Contributor

    This can be closed now.

  12. frewsxcv commented on Feb 25, 2016

    @frewsxcv
    ContributorAuthor

    Thanks again @dileepbapat!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions