-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
dead code (+ unused assignment, etc) warnings in macros do more harm than good #24580
Comments
I would like this. http://doc.rust-lang.org/bitflags/bitflags/macro.bitflags!.html is really annoying without it. |
In the mean time I'm using the following workaround:
It's not generic - you'll need to customize it for your struct - but at least it's something. |
Still repros. |
@pnkfelix Are you still passionate about this? |
I would still want this if possible. I have this macro:
This is for testing variable lengths packets (lists of strings) in a custom protocol. Usage is as follows:
I am rather pleased that macro and assert code are easy to read and understand, but for the last instance of the macro expansion I always get Maybe there is a way to avoid it, but I did not find it yet - I added a semantically non-sensical |
+1 for me. I'm trying to figure out a workaround for these warnings as well. |
(imported from improperly closed bug #17427)
Consider the following code:
playpen
The
unused_assignments
lint fires from the expansion of the second occurrence ofm!()
. But if you follow the advice of the lint and remove the assignment, you discover that the assignment was in fact significant, because when you remove the assignment, the side effect from the first occurrence ofm!()
is lost, and so the call tog
divides by zero.There are a number of different ways to handle this.
The text was updated successfully, but these errors were encountered: