Skip to content

Is there a lint configuration that would deny usage of std::any::Any? #13451

Answered by flip1995
facetious asked this question in Q&A
Discussion options

You must be logged in to vote

There's no such lint currently. If you want, we can add such a lint as an allow-by-default (opt-in) lint in the restriction group. If you want to contribute this lint, take a look at our book and how to add new lints: https://doc.rust-lang.org/clippy/development/defining_lints.html

with a project that is intended to be closed and finite

In Rust there is almost never a reason why you should use Any, even during development. I've never needed it in the >6 years I've been writing Rust. I've also never seen Any in other code, when it wasn't absolutely necessary. Probably the reason, why this lint was never requested or implemented.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@facetious
Comment options

Answer selected by facetious
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants