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

Fix clippy warning for enums that impl Copy #526

Closed
wants to merge 2 commits into from

Conversation

pcrumley
Copy link
Contributor

@pcrumley pcrumley commented Mar 13, 2024

This PR changes the definition of From<&self> to explicitly use de-referencing instead of clone.

I implemented this before I saw your comment on this PR #502 where you say you don't believe on getting clippy to pass on the derived code if it means the code becomes more complicated.

Personally I think that since this code only adds a single branch condition it may still be worth taking. It's up to you to decide if you want to take it.

Either way, now that I know the stance of the crate I will disable clippy on generated code from this library.

Thanks for your work!

@ahl
Copy link
Collaborator

ahl commented Mar 20, 2024

I really appreciate this PR; as you note I've come to the opinion that clippy should just be disabled for generated code. I hear you that it only adds a single new case... but I don't think it's the right approach to chase these... even when the code to do so is relatively minimal. If you feel like I'm wrong or this is the wrong approach please let me know. Otherwise my inclination is to close this PR.

@pcrumley
Copy link
Contributor Author

It's all good. It's your project! I just appreciate the upgrades to it. I wrote up the code locally, and then saw your comment when I opened the PR.

I personally think it could be a valid goal to get the generated code to pass clippy, but i understand your stance and it's simple enough to disable clippy on the module

@pcrumley pcrumley closed this Mar 20, 2024
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