File tree 4 files changed +16
-1
lines changed
4 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1105,6 +1105,7 @@ impl UnusedDelimLint for UnusedBraces {
1105
1105
|| matches ! ( expr. kind, ast:: ExprKind :: Lit ( _) ) )
1106
1106
&& !cx. sess ( ) . source_map ( ) . is_multiline ( value. span )
1107
1107
&& value. attrs . is_empty ( )
1108
+ && !expr. span . from_expansion ( )
1108
1109
&& !value. span . from_expansion ( )
1109
1110
&& !inner. span . from_expansion ( )
1110
1111
{
Original file line number Diff line number Diff line change 2
2
// run-rustfix
3
3
#![warn(unused_braces)]
4
4
5
+ macro_rules! make_1 {
6
+ () => {
7
+ 1
8
+ }
9
+ }
10
+
5
11
struct A<const N: usize>;
6
12
7
13
fn main() {
8
14
let _: A<7>; // ok
9
15
let _: A<7>; //~ WARN unnecessary braces
10
16
let _: A<{ 3 + 5 }>; // ok
17
+ let _: A<{make_1!()}>; // ok
11
18
}
Original file line number Diff line number Diff line change 2
2
// run-rustfix
3
3
#![ warn( unused_braces) ]
4
4
5
+ macro_rules! make_1 {
6
+ ( ) => {
7
+ 1
8
+ }
9
+ }
10
+
5
11
struct A < const N : usize > ;
6
12
7
13
fn main ( ) {
8
14
let _: A < 7 > ; // ok
9
15
let _: A < { 7 } > ; //~ WARN unnecessary braces
10
16
let _: A < { 3 + 5 } > ; // ok
17
+ let _: A < { make_1 ! ( ) } > ; // ok
11
18
}
Original file line number Diff line number Diff line change 1
1
warning: unnecessary braces around const expression
2
- --> $DIR/unused_braces.rs:9 :14
2
+ --> $DIR/unused_braces.rs:15 :14
3
3
|
4
4
LL | let _: A<{ 7 }>;
5
5
| ^^ ^^
You can’t perform that action at this time.
0 commit comments