-
Notifications
You must be signed in to change notification settings - Fork 1.7k
as_conversions triggers on derived code #9657
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
Comments
I'm not sure why this is not considered as |
The |
Yeah I'm not familiar with clippy code, but looking at this it seems that it only check entire expression's
However, in case like serde-repr's ( Beyond those guesses, I'm not even sure what the fix would look like / how to check for the keyword's span specifically. |
This might need |
@rustbot claim |
@Jarcho to use |
You can also implement |
Summary
I like using as_conversions as a catch-all guard to stop myself from reaching for it in my own code when better solutions are available. However, it triggers on the generated derive code too, e.g. when using serde-repr.
Worse, it can't even be disabled by putting
#[allow(clippy::as_conversions)]
on the offending type, as it doesn't propagate to the derive-generated code, so the only option is to opt-out at the module level.Lint Name
as_conversions
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
(no warning, as the
as
conversion is used internally by an external crate)Version
Additional Labels
@rustbot label +T-macros
The text was updated successfully, but these errors were encountered: