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

Clarify Rule: Never use the default case when switching over an enum #214

Merged
merged 2 commits into from
Mar 21, 2023

Conversation

teddy5518
Copy link
Contributor

@teddy5518 teddy5518 commented Mar 20, 2023

Summary

This PR proposes clarifying the rule of "Never use the default case when switching over an enum" to be more specific.

Reasoning

I clarified rule with "real world" example and to follow clear and understandable examples that the guide is providing. (such as universe, weather and etc.)

Please review. Thanks! 😄

Reviewers
cc. @calda

Please react with 👍/👎 if you agree or disagree with this proposal.

Summary
This PR proposes clarifying the rule "Never use the default case when switching over an enum" to be more specific.

Reasoning
I clarified rule with "real world" example and to follow clear and understandable examples that the guide is providing. (such as universe, weather and etc.)

Open to suggestions on this, thanks! 😄

Reviewers
cc. @calda

Please react with 👍/👎 if you agree or disagree with this proposal.
Copy link
Member

@calda calda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement!

README.md Outdated
default:
// Do something else.
// Stop your vehicle
}

// RIGHT
switch anEnum {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be switch trafficLight {?

Copy link
Contributor Author

@teddy5518 teddy5518 Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Thank you so much for pointing out. Fixed it accordingly.
@calda Please review again. 😃

Copy link
Contributor

@bachand bachand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this. Thanks!

@calda calda merged commit afd9330 into airbnb:master Mar 21, 2023
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

Successfully merging this pull request may close these issues.

3 participants