Closed
Description
Code
fn foo() {
return (_ = 42);
}
Current output
warning: unnecessary parentheses around `return` value
--> src/lib.rs:2:12
|
2 | return (_ = 42);
| ^ ^
|
= note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
|
2 - return (_ = 42);
2 + return _ = 42;
|
Desired output
No output, since removing the parentheses results in a compile error:
error: expected one of `;`, `}`, or an operator, found reserved identifier `_`
--> src/lib.rs:2:12
|
2 | return _ = 42;
| ^ expected one of `;`, `}`, or an operator
Rationale and extra context
No response
Other cases
No response
Rust Version
$ rustc -vV
rustc 1.84.0-nightly (662180b34 2024-10-20)
binary: rustc
commit-hash: 662180b34d95f72d05b7c467b0baf4d23d36b1e1
commit-date: 2024-10-20
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1
Anything else?
No response