Skip to content

Commit 75d2364

Browse files
committed
Add 'negative' test for 2015 exception
1 parent 1c7a6db commit 75d2364

6 files changed

+33
-24
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ check-pass
2+
//@ edition: 2015
3+
4+
#![deny(unused_parens)]
5+
6+
mod dyn {
7+
pub type IsAContextualKeywordIn2015 = ();
8+
}
9+
10+
pub type DynIsAContextualKeywordIn2015A = dyn::IsAContextualKeywordIn2015;
11+
12+
// there's no lint here, because the type of how dyn is parsed in edition 2015
13+
pub type DynIsAContextualKeywordIn2015B = Box<dyn (::std::ops::Fn())>;
14+
15+
fn main() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ run-rustfix
2+
//@ edition: 2018
3+
4+
#![deny(unused_parens)]
5+
6+
pub type DynIsAContextualKeywordIn2015 = Box<dyn ::std::ops::Fn()>; //~ ERROR unnecessary parentheses around type
7+
8+
fn main() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ run-rustfix
2+
//@ edition: 2018
3+
4+
#![deny(unused_parens)]
5+
6+
pub type DynIsAContextualKeywordIn2015 = Box<dyn (::std::ops::Fn())>; //~ ERROR unnecessary parentheses around type
7+
8+
fn main() {}

tests/ui/lint/unused/unused-parens-trait-obj.e2018.stderr renamed to tests/ui/lint/unused/unused-parens-trait-obj-e2018-and-after.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: unnecessary parentheses around type
2-
--> $DIR/unused-parens-trait-obj.rs:9:50
2+
--> $DIR/unused-parens-trait-obj-e2018-and-after.rs:6:50
33
|
44
LL | pub type DynIsAContextualKeywordIn2015 = Box<dyn (::std::ops::Fn())>;
55
| ^ ^
66
|
77
note: the lint level is defined here
8-
--> $DIR/unused-parens-trait-obj.rs:7:9
8+
--> $DIR/unused-parens-trait-obj-e2018-and-after.rs:4:9
99
|
1010
LL | #![deny(unused_parens)]
1111
| ^^^^^^^^^^^^^

tests/ui/lint/unused/unused-parens-trait-obj.e2018.fixed

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/lint/unused/unused-parens-trait-obj.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)