File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -843,6 +843,10 @@ trait UnusedDelimLint {
843
843
&& !snip. ends_with ( ' ' )
844
844
{
845
845
" "
846
+ } else if let Ok ( snip) = sm. span_to_prev_source ( value_span)
847
+ && snip. ends_with ( |c : char | c. is_alphanumeric ( ) )
848
+ {
849
+ " "
846
850
} else {
847
851
""
848
852
} ;
@@ -852,6 +856,10 @@ trait UnusedDelimLint {
852
856
&& !snip. starts_with ( ' ' )
853
857
{
854
858
" "
859
+ } else if let Ok ( snip) = sm. span_to_prev_source ( value_span)
860
+ && snip. starts_with ( |c : char | c. is_alphanumeric ( ) )
861
+ {
862
+ " "
855
863
} else {
856
864
""
857
865
} ;
Original file line number Diff line number Diff line change
1
+ #![ deny( unused_parens) ]
2
+
3
+ macro_rules! wrap {
4
+ ( $name: ident $arg: expr) => {
5
+ $name( $arg) ;
6
+ } ;
7
+ }
8
+
9
+ fn main ( ) {
10
+ wrap ! ( unary( routine( ) ) ) ; //~ ERROR unnecessary parentheses around function argument
11
+ wrap ! ( unary ( routine( ) ) ) ; //~ ERROR unnecessary parentheses around function argument
12
+ }
13
+
14
+ fn unary ( _: ( ) ) { }
15
+ fn routine ( ) { }
Original file line number Diff line number Diff line change
1
+ error: unnecessary parentheses around function argument
2
+ --> $DIR/unused_parens_follow_ident.rs:10:16
3
+ |
4
+ LL | wrap!(unary(routine()));
5
+ | ^ ^
6
+ |
7
+ note: the lint level is defined here
8
+ --> $DIR/unused_parens_follow_ident.rs:1:9
9
+ |
10
+ LL | #![deny(unused_parens)]
11
+ | ^^^^^^^^^^^^^
12
+ help: remove these parentheses
13
+ |
14
+ LL - wrap!(unary(routine()));
15
+ LL + wrap!(unary routine());
16
+ |
17
+
18
+ error: unnecessary parentheses around function argument
19
+ --> $DIR/unused_parens_follow_ident.rs:11:17
20
+ |
21
+ LL | wrap!(unary (routine()));
22
+ | ^ ^
23
+ |
24
+ help: remove these parentheses
25
+ |
26
+ LL - wrap!(unary (routine()));
27
+ LL + wrap!(unary routine());
28
+ |
29
+
30
+ error: aborting due to 2 previous errors
31
+
You can’t perform that action at this time.
0 commit comments