rust-lang / rust-lang/rust-clippy
doc: `same_functions_in_if_condition` example contradicts actual lint behavior
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
The same_functions_in_if_condition lint is supposed to check that function is called several times in if conditions
But the "correct" example suggest the exact code that should trigger the lint:
https://github.com/rust-lang/rust-clippy/blob/d7246b03ea4761416cfba19d34708e4200fce604/clippy_lints/src/ifs/mod.rs#L120-L127
The whole doc for this lint looks like a copy-paste error to me.
I was just browsing clippy lints and this one confused me.
Not sure what the correct documentation should look like, therefore an issue.
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 in clippy_lints/src/ifs/mod.rs around lines 120-127 and compare the documented examples with the actual same_functions_in_if_condition behavior. Trace the lint's nearby implementation or checks to determine which example should trigger it. Done means the lint documentation clearly distinguishes the triggering and non-triggering code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100