about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/debug.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-28 08:48:35 +0000
committerbors <bors@rust-lang.org>2023-08-28 08:48:35 +0000
commit4118738998993f0c4b0eb30eda502f21ebd28c4e (patch)
treedc188349bd09836529ae9670e80ee471551f19d0 /compiler/rustc_mir_transform/src/coverage/debug.rs
parent8de52e5bf4a90f7f0f2f58be3432d860870c39b8 (diff)
parentdba7763128356f684f31a0a1aff25ac3e9646818 (diff)
downloadrust-4118738998993f0c4b0eb30eda502f21ebd28c4e.tar.gz
rust-4118738998993f0c4b0eb30eda502f21ebd28c4e.zip
Auto merge of #11401 - y21:issue11394, r=xFrednet
[`if_then_some_else_none`]: look into local initializers for early returns

Fixes #11394

As the PR title says, problem was that it only looked for early returns in semi statements. Local variables don't count as such, so it didn't count `let _v = x?;` (or even just `let _ = return;`) as a possible early return and didn't realize that it can't lint then.

Imo the `stmts_contains_early_return` function that was used before is redundant. `contains_return` could already do that if we just made the parameter a bit more generic, just like `for_each_expr`, which can already accept `&[Stmt]`

changelog: [`if_then_some_else_none`]: look into local initializers for early returns
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions