-
Notifications
You must be signed in to change notification settings - Fork 1.8k
minor: suppress 'clippy::approx_constant' lint in test case #13863
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
Conversation
This repository doesn't accept |
I did read up on those after submitting this PR. it's... an odd position. Occasionally clippy will suggest changes for performance/correctness reasons. Having clippy error out early over unsuppressed false positives obscures these cases during local development. Not to mention there's quite a few commits that seem to be for addressing clippy lints. Eg, d3dbf9c |
We take PRs for selective fixes which improve performance or simplify the code, and we have a cargo alias which runs clippy for categories of lints. I don't think we're at risk here to duplicate mathematical constants, we're not that kind of app, and there's not much point in fixing these in RA. |
In this case there is no need for that test to use pi, you can suppress the lint by using |
intentionally changing perfectly reasonable code in order to suppress a clippy false positive hardly seems better than explicitly suppressing the lint, no? If it would get this merged i'm happy to do it, but i'm struggling to understand how it's better |
The benefit is that it wouldn't make noise for other readers. But it's still an arbitrary change to make clippy happy, which is against the clippy policy. |
We might want to revisit the clippy policy at some point. I personally would like for us to enable clippy on rust-analyzer at some point, but only once we are able to specify the lints we are interested in in a project-wide place, which to my knowledge is still not really possible. |
CC #13865 |
i've updated this PR to use a different arbitrary decimal that clippy won't complain about. I understand the concerns about this change, and in particular the purist perspective that this violates the clippy policy. On the other hand, from a pragmatic perspective, this change provides a small practical benefit with no real downside. I leave it for the brains trust to decide what to do with it |
@bors r+ |
☀️ Test successful - checks-actions |
suppresses a false positive clippy lint