rust-lang / rust-lang/rust-clippy
Making `try_err` warn-by-default
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Description
try_err is currently an allow-by-default restriction lint.
I think it should be moved into a warn-by-default lint. First, I consider it bad style and unidiomatic. This is arguably subjective.
But the bigger problem is that people keep being confused by the limitations of this pattern. They often think that Err(err)? should be considered a diverging expression, when it is indeed not. If we started linting against the pattern (possibly even with an explanation that it is not diverging) then it should hopefully reduce confusion.
I think we should even uplift it at some point, but first clippy should start making it warn-by-default to collect feedback.
Here are some recent examples of issues opened on rust-lang/rust because of this: #106377 #106357
For reference, here's the lint page: https://rust-lang.github.io/rust-clippy/master/#try_err
Version
No response
Additional Labels
@rustbot label C-enhancement
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 with the try_err lint page linked in the issue and review the referenced Rust issues (#106377 and #106357) to understand the reported confusion. Locate the lint's default-level configuration in rust-clippy, change it to warn-by-default, and verify that the lint page and relevant behavior reflect the new level.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100