Skip to content

Commit b22f0a7

Browse files
add test for duplicate warning on used deprecated unit structs
Co-authored-by: Waffle Lapkin <[email protected]>
1 parent ebe145e commit b22f0a7

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#![deny(deprecated)]
2+
#![allow(unused_imports)]
3+
4+
#[deprecated]
5+
pub mod a {
6+
pub struct Foo;
7+
pub struct Bar();
8+
pub struct Baz {}
9+
}
10+
11+
12+
use a::Foo;
13+
//~^ ERROR use of deprecated struct `a::Foo`
14+
//~| ERROR use of deprecated unit struct `a::Foo`
15+
use a::Bar;
16+
//~^ ERROR use of deprecated struct `a::Bar`
17+
//~| ERROR use of deprecated tuple struct `a::Bar`
18+
use a::Baz;
19+
//~^ ERROR use of deprecated struct `a::Baz`
20+
21+
fn main() {
22+
a::Foo;
23+
//~^ ERROR use of deprecated unit struct `a::Foo`
24+
a::Bar();
25+
//~^ ERROR use of deprecated tuple struct `a::Bar`
26+
a::Baz {};
27+
//~^ ERROR use of deprecated struct `a::Baz`
28+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
error: use of deprecated struct `a::Foo`
2+
--> $DIR/unit_and_tuple_struct.rs:12:8
3+
|
4+
LL | use a::Foo;
5+
| ^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/unit_and_tuple_struct.rs:1:9
9+
|
10+
LL | #![deny(deprecated)]
11+
| ^^^^^^^^^^
12+
13+
error: use of deprecated unit struct `a::Foo`
14+
--> $DIR/unit_and_tuple_struct.rs:12:8
15+
|
16+
LL | use a::Foo;
17+
| ^^^
18+
19+
error: use of deprecated struct `a::Bar`
20+
--> $DIR/unit_and_tuple_struct.rs:15:8
21+
|
22+
LL | use a::Bar;
23+
| ^^^
24+
25+
error: use of deprecated tuple struct `a::Bar`
26+
--> $DIR/unit_and_tuple_struct.rs:15:8
27+
|
28+
LL | use a::Bar;
29+
| ^^^
30+
31+
error: use of deprecated struct `a::Baz`
32+
--> $DIR/unit_and_tuple_struct.rs:18:8
33+
|
34+
LL | use a::Baz;
35+
| ^^^
36+
37+
error: use of deprecated unit struct `a::Foo`
38+
--> $DIR/unit_and_tuple_struct.rs:22:6
39+
|
40+
LL | a::Foo;
41+
| ^^^
42+
43+
error: use of deprecated tuple struct `a::Bar`
44+
--> $DIR/unit_and_tuple_struct.rs:24:6
45+
|
46+
LL | a::Bar();
47+
| ^^^
48+
49+
error: use of deprecated struct `a::Baz`
50+
--> $DIR/unit_and_tuple_struct.rs:26:6
51+
|
52+
LL | a::Baz {};
53+
| ^^^
54+
55+
error: aborting due to 8 previous errors
56+

0 commit comments

Comments
 (0)