Skip to content

Commit

Permalink
Rollup merge of rust-lang#124099 - voidc:disallow-ambiguous-expr-attr…
Browse files Browse the repository at this point in the history
…s, r=davidtwco

Disallow ambiguous attributes on expressions

This implements the suggestion in [rust-lang#15701](rust-lang#15701 (comment)) to disallow ambiguous outer attributes on expressions. This should resolve one of the concerns blocking the stabilization of `stmt_expr_attributes`.
  • Loading branch information
matthiaskrgr authored Apr 23, 2024
2 parents 9ca9d71 + 26484ce commit 53b5056
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/ui/cfg_attr_rustfmt.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn foo(

fn skip_on_statements() {
#[rustfmt::skip]
5+3;
{ 5+3; }
}

#[rustfmt::skip]
Expand All @@ -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; }
}
6 changes: 3 additions & 3 deletions tests/ui/cfg_attr_rustfmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn foo(

fn skip_on_statements() {
#[cfg_attr(rustfmt, rustfmt::skip)]
5+3;
{ 5+3; }
}

#[cfg_attr(rustfmt, rustfmt_skip)]
Expand All @@ -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; }
}

0 comments on commit 53b5056

Please sign in to comment.