Open
Description
Lint name: match_single_binding
I tried this code:
fn main() {
match format_args!("hello {}", "world") {
f => dbg!(f),
};
}
Clippy prints a warning:
warning: this match could be written as a `let` statement
With a proposal:
let f = format_args!("hello {}", "world");
dbg!(f);
But suggested code does not compile, because f
is bound to a temporary value and its lifetime ends before dbg!
.
Meta
cargo clippy -V
: 0.1.51 (2021-01-20 a4cbb44)rustc -Vv
:
rustc 1.49.0 (e1884a8e3 2020-12-29)
binary: rustc
commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
commit-date: 2020-12-29
host: x86_64-unknown-linux-gnu
release: 1.49.0
Metadata
Metadata
Assignees
Labels
Category: Clippy is not doing the correct thingCall for participation: This a hard problem and requires more experience or effort to work onIssue: The lint was triggered on code it shouldn't haveIssue: The suggestions provided by this Lint cause an ICE/error when appliedType: This lint will require working with the MIR