rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.37k stars 1.53k forks source link

New lint: generalize `exit`, `todo`, `mem_forget`, etc. #8031

Open ojeda opened 2 years ago

ojeda commented 2 years ago

What it does

The new lint(s) would be a generalization of other lints that check for usage of some functions, types, macros, etc.:

etc. It would be a continuation of other lints such as disallowed_methods and disallowed_types.

The new lint(s) would be useful for big projects that may want to avoid particular items coming from dependencies, or to discourage their usage in general (requiring an explicit allow), or to deprecate certain items (while keeping existing ones), etc.

Categories (optional)

Drawbacks

None (since projects would be responsible for the lists).

xFrednet commented 2 years ago

We have the disallowed_methods and disallowed_types lints. Having this for functions sounds reasonable. Macros can be a bit iffy but might be worth a try :upside_down_face:

ojeda commented 2 years ago

Thanks! I will add the links to the OP message.

Veykril commented 1 year ago

We have the disallowed_methods and disallowed_types lints. Having this for functions sounds reasonable. Macros can be a bit iffy but might be worth a try 🙃

If I see this right disallowed_methods already handles functions in general no? Macros seem to be handled since https://github.com/rust-lang/rust-clippy/pull/9495 as well now, what exactly would be left for this issue (I am unsure I understand the remaining points in the main issue text)?

ojeda commented 1 year ago

Indeed, some of this seems to be covered now. I have updated the list above -- we may want to split this into different issues.