-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
needless_pass_by_value makes no sense for C-like enums #2222
Comments
Also, |
Deriving // deriving `Copy`
lelt x = Foo::Bar;
f(x);
f(x); // ok // taking by reference
let x = Foo::Bar;
f(&x);
f(&x); // ok You can |
can you elaborate? We'd like to eliminate them. |
Oops, I didn't mean false-positives. I think there are many true-positives in places where one don't care care about this (tests, private helper that aren't called multiple times, etc.). They should be fine with |
How about we suggest either using a reference OR implementing |
Sounds good enough to me (especially now that I suddenly realized that C-like enums that don't feature discriminators explicitly ( |
Ok, so to fix this issue, one needs to check if the type is local to the crate. If it is, then a second suggestion should be added (adding Bonus points for detecting the case where the second suggestion is not applicable and not producing it in that case |
I don't want to open a new issue for this, but does |
Sometimes you need to, because sometimes you need the ability to clone it into a new one. Ideally |
Here,
Foo
can be easily copied (hey, we can even cast it toi32
!), so there's no point in referencing and dereferencing it all over the code.The text was updated successfully, but these errors were encountered: