rust-lang / rust-lang/rust-clippy
[Book]: Add new section for collections of lints, that focus on the same problem
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Note: The start of the issue is a discussion, how to best address the suggestion. This comment outlines what should be done. The rest can be used for context.
What it does
restriction-level lint that checks for code that might panic. For example, right now there's unwrap_used, or expect_used. This would unify those types of lints. Ideally, it would also be able to detect other sources of panics, like calling a function that might panic. I noticed that missing_panics_doc is not triggered when a user-defined function that panics is called, which is a problem.
Advantage
Panicking is generally discouraged, and handling errors with Results or Options is recommended.
Drawbacks
It can be overly restrictive, and likely wouldn't provide a fix in certain cases.
Example
let numbers = &[4, 7, 3];
let my_number = numbers[5];
Could be written as:
let numbers = &[4, 7, 3];
let Some(my_number) = numbers.get(5) else {
// handle
};
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 linked issue comment, which the issue identifies as the current guidance, then inspect the Clippy Book structure to find the appropriate location for a section about collections of lints focused on the same problem. Done means the proposed collection is documented in the Book with enough context for users to understand its purpose and scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100