-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Lint name: needless_return
I tried this code:
#![feature(let_else)]
pub fn hoge(x: Option<u32>) {
let Some(x) = x else { return; };
dbg!(x);
}
I expected to see this happen: No warnings emitted
Instead, this happened:
Checking playground v0.0.1 (/playground)
warning: unneeded `return` statement
--> src/lib.rs:3:28
|
3 | let Some(x) = x else { return; };
| ^^^^^^^ help: remove `return`
|
= note: `#[warn(clippy::needless_return)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
Meta
Rust version (rustc -Vv
):
rustc 1.56.0-nightly (50171c310 2021-09-01)
binary: rustc
commit-hash: 50171c310cd15e1b2d3723766ce64e2e4d6696fc
commit-date: 2021-09-01
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 13.0.0
camsteffen
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have