rust-lang / rust-lang/rust-clippy
Lint idea: error handling code that ignores or only logs the error
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
This might not be the best idea. It also might not be easy to implement. But I wanted to put it here as food for thought. I got the idea from this paper, which says that one of the signs that there might be a problem is "Error handlers that ignore errors (or just contain a log statement)".
So perhaps if there's this code:
match something {
Ok(stuff) => {
// happy path stuff
},
Err(e) => {
error!("logging this error");
},
}
Or without anything in the Err arm, just Err(e) => {}, then this proposed lint would point these out?
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
The issue names no files, tests, or entry points. First clarify the intended behavior for empty Err arms and arms that only log an error, then determine the scope of a Clippy lint from the existing project structure. Done means the lint's behavior and implementation approach are agreed, with coverage for the proposed examples.
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
- Mostly clear
- Newbie friendliness
- 25/100