Fix return_and_then FP when return type is not Option or Result#14950
Fix return_and_then FP when return type is not Option or Result#14950profetia wants to merge 1 commit intorust-lang:masterfrom
return_and_then FP when return type is not Option or Result#14950Conversation
|
So this fixes the issue by checking if the enclosing function's return type is Option or Result so that the Thinking about this, it seems surprising to me that we lint So even with this fix, we would presumably still emit a warning on the test case if the closure had Makes me wonder if this is a false positive with the Though I also haven't looked at its usages in rustc, this might just be intended and we're using this in ways it's not meant to be used. Perhaps we could just replace that call with some manual checks that it really is the tail return expression of the function. What do you think about instead of checking the return type, fixing the logic in how it checks if the expression is actually returned? |
|
Not sure if it is a FP of |
|
r? clippy |
|
Closed in favor of #15115 |
Closes #14927
changelog: [
return_and_then] fix FP when return type is notOptionorResult