Skip to content

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

Merged
merged 2 commits into from
Jan 9, 2023

Conversation

danieleades
Copy link
Contributor

suppresses a false positive clippy lint

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 30, 2022
@HKalbasi
Copy link
Member

This repository doesn't accept #[allow(clippy::*)] attributes and in general doesn't consider all clippy lints helpful. See https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/style.md#clippy

@danieleades
Copy link
Contributor Author

This repository doesn't accept #[allow(clippy::*)] attributes and in general doesn't consider all clippy lints helpful. See https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/style.md#clippy

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

@lnicola
Copy link
Member

lnicola commented Dec 30, 2022

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.

@HKalbasi
Copy link
Member

In this case there is no need for that test to use pi, you can suppress the lint by using 0.123456789 instead of pi.

@danieleades
Copy link
Contributor Author

In this case there is no need for that test to use pi, you can suppress the lint by using 0.123456789 instead of pi.

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

@HKalbasi
Copy link
Member

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.

@Veykril
Copy link
Member

Veykril commented Dec 30, 2022

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.

@lnicola
Copy link
Member

lnicola commented Dec 30, 2022

CC #13865

@danieleades
Copy link
Contributor Author

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

@Veykril
Copy link
Member

Veykril commented Jan 9, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Jan 9, 2023

📌 Commit b196e5b has been approved by Veykril

It is now in the queue for this repository.

@lnicola lnicola changed the title suppress 'clippy::approx_constant' lint in test case minor: suppress 'clippy::approx_constant' lint in test case Jan 9, 2023
@bors
Copy link
Contributor

bors commented Jan 9, 2023

⌛ Testing commit b196e5b with merge ba204ef...

@bors
Copy link
Contributor

bors commented Jan 9, 2023

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing ba204ef to master...

@bors bors merged commit ba204ef into rust-lang:master Jan 9, 2023
@danieleades danieleades deleted the approx-constant branch January 9, 2023 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants