Skip to content
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

Consecutive returns dont decrease cognitive Complexity level anymore #14460

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cerdelen
Copy link

changelog: [`cognitive_complexity`]: Consecutive return calls decreased complexity level of the function by 1.

fixes #14422

@rustbot
Copy link
Collaborator

rustbot commented Mar 24, 2025

r? @y21

rustbot has assigned @y21.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Mar 24, 2025
@rustbot

This comment has been minimized.

… multiple times
@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Mar 24, 2025
@y21
Copy link
Member

y21 commented Mar 29, 2025

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 return expressions after one another

@cerdelen
Copy link
Author

Not sure if it does have some real life reason to ever have 2 return statements in a row. But just using the example from the issue itself i could see that indeed just putting 2 returns in a row does reduce the level which surely isn't intentional.

fixes #14422

i added the id of the issue apparently it wasnt linked before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants