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

Add lint for calling mem::discriminant on a non-enum type #3346

Merged
merged 4 commits into from
Oct 25, 2018

Conversation

HMPerson1
Copy link
Contributor

Also, if the type is a reference to an enum, we suggest removing &s and/or dereferencing.

Fixes #3342

@HMPerson1
Copy link
Contributor Author

HMPerson1 commented Oct 21, 2018

not sure what happened here https://travis-ci.org/rust-lang-nursery/rust-clippy/jobs/444259747

@flip1995
Copy link
Member

not sure what happened here

Timeout, happens sometimes. I restarted it

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Applicability level of this lint is missing.

Could you add a test for calling this function inside of a macro? Most of the time macros result in weird suggestions/behavior.

clippy_lints/src/mem_discriminant.rs Outdated Show resolved Hide resolved
clippy_lints/src/mem_discriminant.rs Show resolved Hide resolved
@flip1995
Copy link
Member

Thanks!

bors r+

bors bot added a commit that referenced this pull request Oct 25, 2018
3346: Add lint for calling `mem::discriminant` on a non-enum type r=flip1995 a=HMPerson1

Also, if the type is a reference to an enum, we suggest removing `&`s and/or dereferencing.

Fixes #3342

Co-authored-by: HMPerson1 <hmperson1@gmail.com>
Co-authored-by: Philipp Krones <hello@philkrones.com>
@bors
Copy link
Contributor

bors bot commented Oct 25, 2018

@bors bors bot merged commit d53e6f8 into rust-lang:master Oct 25, 2018
@HMPerson1 HMPerson1 deleted the mem_discrim branch October 25, 2018 16:03
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.

2 participants