New lint: generalize exit
, todo
, mem_forget
, etc. · Issue #8031 · rust-lang/rust-clippy (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
What it does
The new lint(s) would be a generalization of other lints that check for usage of some functions, types, macros, etc.:
- exit could be generalized to take a list of functions to check for (including those of the same project, not just the standard library).
- Handled now by disallowed_methods.
- todo could be generalized to take a list of macros too.
- Handled now by disallowed_macros.
- undocumented_unsafe_blocks could be generalized to other comments apart from
// SAFETY: ...
(for unsafe_code).// PANIC: ...
for panic, unwrap_used...// CAST: ...
for as_conversions (and related ones).- Partially related to lint_reasons's
reason = "..."
, Cc @xFrednet.
- missing_safety_doc could be generalized to
# Panics
sections (even if it only catches a subset of cases). - mem_forget gives another idea for generalization: for each function in the list, optionally give a list of traits to check to (not) be implemented for their arguments.
- It could also be generalized to take paths only or do the matching textually (possibly including regex support).
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)
- Kind: restriction.
Drawbacks
None (since projects would be responsible for the lists).