Skip to content
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

declare_interior_mutable_const should probably be downgraded #5863

Closed
ijackson opened this issue Aug 3, 2020 · 3 comments · Fixed by #6098
Closed

declare_interior_mutable_const should probably be downgraded #5863

ijackson opened this issue Aug 3, 2020 · 3 comments · Fixed by #6098
Labels
A-documentation Area: Adding or improving documentation C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy

Comments

@ijackson
Copy link

ijackson commented Aug 3, 2020

Hi. I ran into #3962 (interior mutability complaint even if non-interior-mutable enum variants are used). Searching for the name of the lint found me #5050, and also #5812 (which relates to types which have "buried" interior mutability and which therefore don't present the semantic hazard that this lint is aimed at).

In #5812 clippy suggests using lazy_static which is right if the user actually wanted the interior mutability, but is not a good approach if all that's needed is to suppress this lint.

This lint is deny by default. I think it is not sufficiently reliable for that. The issue conversations show people who are concerned that they would be missing a serious problem and are mistakenly reluctant to suppress this lint.

I suggest that the lint should be downgraded to warn-by-default.

Also I think these issues should be discussed in https://rust-lang.github.io/rust-clippy/master/index.html#declare_interior_mutable_const under "Known problems".

I'm not very familiar with clippy but this doesn't sound like it would be a difficult change. So if this seems like a good idea to the clippy team please let me know and I will prepare an MR.

Thanks,
Ian.

@ijackson ijackson added the C-bug Category: Clippy is not doing the correct thing label Aug 3, 2020
@flip1995 flip1995 added good-first-issue These issues are a good way to get started with Clippy A-documentation Area: Adding or improving documentation labels Aug 16, 2020
@longlb
Copy link
Contributor

longlb commented Sep 5, 2020

I'd like to tackle this one if no one else has.

@longlb
Copy link
Contributor

longlb commented Sep 5, 2020

Is there a way to change the lint's level directly or do I have to change its lint group as well? And if its the lint group that has to change, should it be to style, complexity, or perf? This is to facilitate the change from deny to warn by default.

@ebroto
Copy link
Member

ebroto commented Sep 6, 2020

@longlb you need to change the group of the lint. I agree there is no clear candidate, but I guess style is the closer one.

I think we could have a suspicious (or something similar) category for this cases, but that would be another issue and there are plans to change how lints are categorized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documentation Area: Adding or improving documentation C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy
Projects
None yet
4 participants