Add an allow attribute suggestion along with the implied by suggestion by Urgau · Pull Request #114089 · rust-lang/rust (original) (raw)

@xFrednet That sounds sensible and may be a better default than allow, though it may not always be the desired one.

For instance, in the "temporary/development allow" case, consider dead_code. One may be still experimenting with a few things, and thus calling a function or commenting the call from time to time. So the code may go between the dead and used code a few times. In this case, having the allow may be more pleasant. But others may still prefer to have to use expect, in order to avoid forgetting about it even if it requires a bit more work.

In the "committed/permanent allow" case, it is definitely nice to know when something is superfluous. Having said that, I wonder about supporting several toolchain versions. If the behavior of a lint changes, then one could have an expect that starts triggering in a new release, in which case they would need to change it to allow. This may be undesirable for projects that aim to be warning-free as much as possible. I guess it is not much of a concern for rustc lints, assuming they are more "stable" (in behavior) vs. Clippy ones or other custom ones a project may use.

Perhaps the best solution is to suggest both, and let users decide.

By the way, it may be even better/easier to already go for expect if the lint_reasons feature would be split in two features (in the tracking issue I see you said you would prefer not to, though).