unused_parens
lint suggestion also removes attributes on inner expression with feature(stmt_expr_attributes)
.
#129833
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-bug
Category: This is a bug.
F-stmt_expr_attributes
`#![feature(stmt_expr_attributes)]`
L-unused_parens
Lint: unused_parens
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: The
unused_parens
warning fires on all three lines offoo
, and the suggestions should only suggest removing the parentheses, not the attribute also.Instead, this happened: The
unused_parens
fires on the first and last lines offoo
, and the suggestion also removes the#[inline]
.No
unused_parens
warning fires on the second line(#[inline] || println!("Hello!"));
(but this is probably a separate issue, unrelated to attributes; it happens even when the attribute is removed; maybeunused_must_use
overrides it or something).Meta
rustc --version --verbose
:Requires use of
#![feature(stmt_expr_attributes)]
, otherwise the#[inline]
is not legal in that position (though note that theunused_parens
warning and suggestion is the same on stable, there's just anerror[E0658]: attributes on expressions are experimental
first).The issue is not specific to closures and
#[inline]
, but that was the simplest example of a reasonable attribute-on-expression I thought of.@rustbot label +A-diagnostics +requires-nightly
The text was updated successfully, but these errors were encountered: