diff options
| author | Ben Schulz <benshu@benshu.de> | 2025-07-10 08:02:25 +0200 |
|---|---|---|
| committer | Ben Schulz <benshu@benshu.de> | 2025-07-24 20:44:10 +0200 |
| commit | 6fc68c16e7774be27b19ae152507b471d9a1a233 (patch) | |
| tree | bea56f5c5326dbf1551e57c167f43ea50a1c63ae | |
| parent | e958b20af7ad3e3a053070a9c45389fe463ccc0c (diff) | |
| download | rust-6fc68c16e7774be27b19ae152507b471d9a1a233.tar.gz rust-6fc68c16e7774be27b19ae152507b471d9a1a233.zip | |
Add test case for single bound
3 files changed, 35 insertions, 1 deletions
diff --git a/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.fixed b/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.fixed new file mode 100644 index 00000000000..4b0bca3d44a --- /dev/null +++ b/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.fixed @@ -0,0 +1,12 @@ +//@ run-rustfix + +#![deny(unused_parens)] +#![allow(warnings)] +trait MyTrait {} + +fn foo(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait) + Send + Sync>) {} + +//~v ERROR unnecessary parentheses around type +fn bar(_: Box<dyn FnMut(&mut u32) -> &mut dyn MyTrait>) {} + +fn main() {} diff --git a/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.rs b/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.rs index 78f335c26a7..4eefd3dc81a 100644 --- a/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.rs +++ b/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.rs @@ -1,4 +1,4 @@ -//@ check-pass +//@ run-rustfix #![deny(unused_parens)] #![allow(warnings)] @@ -6,4 +6,7 @@ trait MyTrait {} fn foo(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait) + Send + Sync>) {} +//~v ERROR unnecessary parentheses around type +fn bar(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait)>) {} + fn main() {} diff --git a/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.stderr b/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.stderr new file mode 100644 index 00000000000..89455e3db73 --- /dev/null +++ b/tests/ui/lint/unused/unused-parens-false-positive-issue-143653.stderr @@ -0,0 +1,19 @@ +error: unnecessary parentheses around type + --> $DIR/unused-parens-false-positive-issue-143653.rs:10:43 + | +LL | fn bar(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait)>) {} + | ^ ^ + | +note: the lint level is defined here + --> $DIR/unused-parens-false-positive-issue-143653.rs:3:9 + | +LL | #![deny(unused_parens)] + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - fn bar(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait)>) {} +LL + fn bar(_: Box<dyn FnMut(&mut u32) -> &mut dyn MyTrait>) {} + | + +error: aborting due to 1 previous error + |
