-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Consecutive returns dont decrease cognitive Complexity level anymore #14460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
Do you have an example code snippet of some real code that exercises this exception here or motivation on why this change helps? It's a bit hard for me to think about when there would be two |
It is because you put the initial pull-request message into a code block (surrounded by three backticks). I've edited the code block markers out in the initial message, and this has now linked the issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for referencing the issue, that gives some context. LGTM, can you add a test for this in tests/ui/cognitive_complexity.rs
? (Can just copy it from the linked issue)
I may be mistaken here, but the bug was a false negative, and the added test tests that the lint is not triggered. Shouldn't the test added in this PR test that the lint is triggered instead? In other words, the new test would still pass if the bugfix was reverted, which defeats the purpose of the test. |
You are right. I made another pull request. |
changelog: [
cognitive_complexity
]: Consecutive return calls decreased complexity level of the function by 1.fixes #14422