Rollup merge of #124099 - voidc:disallow-ambiguous-expr-attrs, r=davidtwco

Disallow ambiguous attributes on expressions

This implements the suggestion in [#15701](https://github.com/rust-lang/rust/issues/15701#issuecomment-2033124217) to disallow ambiguous outer attributes on expressions. This should resolve one of the concerns blocking the stabilization of `stmt_expr_attributes`.
This commit is contained in:
Matthias Krüger 2024-04-23 12:10:26 +02:00 committed by GitHub
commit 53b5056977
2 changed files with 6 additions and 6 deletions

View file

@ -16,7 +16,7 @@ fn foo(
fn skip_on_statements() {
#[rustfmt::skip]
5+3;
{ 5+3; }
}
#[rustfmt::skip]
@ -33,11 +33,11 @@ mod foo {
#[clippy::msrv = "1.29"]
fn msrv_1_29() {
#[cfg_attr(rustfmt, rustfmt::skip)]
1+29;
{ 1+29; }
}
#[clippy::msrv = "1.30"]
fn msrv_1_30() {
#[rustfmt::skip]
1+30;
{ 1+30; }
}

View file

@ -16,7 +16,7 @@ fn foo(
fn skip_on_statements() {
#[cfg_attr(rustfmt, rustfmt::skip)]
5+3;
{ 5+3; }
}
#[cfg_attr(rustfmt, rustfmt_skip)]
@ -33,11 +33,11 @@ mod foo {
#[clippy::msrv = "1.29"]
fn msrv_1_29() {
#[cfg_attr(rustfmt, rustfmt::skip)]
1+29;
{ 1+29; }
}
#[clippy::msrv = "1.30"]
fn msrv_1_30() {
#[cfg_attr(rustfmt, rustfmt::skip)]
1+30;
{ 1+30; }
}