rust-lang / rust-lang/rust-clippy
New lint: generalize `exit`, `todo`, `mem_forget`, etc.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
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.:
-
exitcould 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.
- Handled now by
-
todocould be generalized to take a list of macros too.- Handled now by
disallowed_macros.
- Handled now by
-
undocumented_unsafe_blockscould be generalized to other comments apart from// SAFETY: ...(forunsafe_code).// PANIC: ...forpanic,unwrap_used...// CAST: ...foras_conversions(and related ones).- Partially related to
lint_reasons'sreason = "...", Cc @xFrednet.
-
missing_safety_doccould be generalized to# Panicssections (even if it only catches a subset of cases). mem_forgetgives 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).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing disallowed_methods, disallowed_types, undocumented_unsafe_blocks, missing_safety_doc, and mem_forget lints linked in the issue. Determine which generalization to pursue, define its scope and configuration, then add coverage demonstrating the selected functions, macros, comments, sections, or trait checks are handled as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100