Skip to content

Commit 5189851

Browse files
committed
Add test case for single bound
1 parent bf0c5d6 commit 5189851

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ run-rustfix
2+
3+
#![deny(unused_parens)]
4+
#![allow(warnings)]
5+
trait MyTrait {}
6+
7+
fn foo(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait) + Send + Sync>) {}
8+
9+
//~v ERROR unnecessary parentheses around type
10+
fn bar(_: Box<dyn FnMut(&mut u32) -> &mut dyn MyTrait>) {}
11+
12+
fn main() {}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
//@ check-pass
1+
//@ run-rustfix
22

33
#![deny(unused_parens)]
44
#![allow(warnings)]
55
trait MyTrait {}
66

77
fn foo(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait) + Send + Sync>) {}
88

9+
//~v ERROR unnecessary parentheses around type
10+
fn bar(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait)>) {}
11+
912
fn main() {}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error: unnecessary parentheses around type
2+
--> $DIR/unused-parens-false-positive-issue-143653.rs:10:43
3+
|
4+
LL | fn bar(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait)>) {}
5+
| ^ ^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/unused-parens-false-positive-issue-143653.rs:3:9
9+
|
10+
LL | #![deny(unused_parens)]
11+
| ^^^^^^^^^^^^^
12+
help: remove these parentheses
13+
|
14+
LL - fn bar(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait)>) {}
15+
LL + fn bar(_: Box<dyn FnMut(&mut u32) -> &mut dyn MyTrait>) {}
16+
|
17+
18+
error: aborting due to 1 previous error
19+

0 commit comments

Comments
 (0)