Skip to content

Commit 62aa6b9

Browse files
committed
update UI test
1 parent 173bc5e commit 62aa6b9

File tree

2 files changed

+32
-45
lines changed

2 files changed

+32
-45
lines changed

tests/ui/pub_underscore_fields.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
#![allow(unused)]
22
#![warn(clippy::pub_underscore_fields)]
33

4+
mod inner {
5+
pub struct PubSuper {
6+
pub(super) a: usize,
7+
pub(super) _b: u8,
8+
_c: i32,
9+
}
10+
11+
mod inner2 {
12+
pub struct PubModVisibility {
13+
pub(in crate::inner) e: bool,
14+
pub(in crate::inner) _f: Option<()>,
15+
}
16+
}
17+
}
18+
419
fn main() {
520
pub struct StructWithOneViolation {
621
pub _a: usize,
@@ -33,19 +48,4 @@ fn main() {
3348
r#pub: bool,
3449
_pub: String,
3550
}
36-
37-
mod inner {
38-
pub struct PubSuper {
39-
pub(super) a: usize,
40-
pub(super) _b: u8,
41-
_c: i32,
42-
}
43-
}
44-
45-
mod inner2 {
46-
pub struct PubModVisibility {
47-
pub(in super::inner) e: bool,
48-
pub(in super::inner) _f: Option<()>,
49-
}
50-
}
5151
}

tests/ui/pub_underscore_fields.stderr

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,51 @@
1-
error[E0433]: failed to resolve: could not find `inner` in the crate root
2-
--> $DIR/pub_underscore_fields.rs:47:27
3-
|
4-
LL | pub(in super::inner) e: bool,
5-
| ^^^^^ could not find `inner` in the crate root
6-
7-
error[E0433]: failed to resolve: could not find `inner` in the crate root
8-
--> $DIR/pub_underscore_fields.rs:48:27
9-
|
10-
LL | pub(in super::inner) _f: Option<()>,
11-
| ^^^^^ could not find `inner` in the crate root
12-
131
error: field marked as public but also inferred as unused because it's prefixed with `_`
14-
--> $DIR/pub_underscore_fields.rs:6:9
2+
--> $DIR/pub_underscore_fields.rs:7:9
153
|
16-
LL | pub _a: usize,
17-
| ^^^^^^
4+
LL | pub(super) _b: u8,
5+
| ^^^^^^^^^^^^^
186
|
197
= help: consider removing the underscore, or making the field private
208
= note: `-D clippy::pub-underscore-fields` implied by `-D warnings`
219

2210
error: field marked as public but also inferred as unused because it's prefixed with `_`
23-
--> $DIR/pub_underscore_fields.rs:13:9
11+
--> $DIR/pub_underscore_fields.rs:14:13
2412
|
25-
LL | pub _c: i64,
26-
| ^^^^^^
13+
LL | pub(in crate::inner) _f: Option<()>,
14+
| ^^^^^^^^^^^^^^^^^^^^^^^
2715
|
2816
= help: consider removing the underscore, or making the field private
2917

3018
error: field marked as public but also inferred as unused because it's prefixed with `_`
31-
--> $DIR/pub_underscore_fields.rs:15:9
19+
--> $DIR/pub_underscore_fields.rs:21:9
3220
|
33-
LL | pub _e: Option<u8>,
21+
LL | pub _a: usize,
3422
| ^^^^^^
3523
|
3624
= help: consider removing the underscore, or making the field private
3725

3826
error: field marked as public but also inferred as unused because it's prefixed with `_`
3927
--> $DIR/pub_underscore_fields.rs:28:9
4028
|
41-
LL | pub(crate) _b: Option<String>,
42-
| ^^^^^^^^^^^^^
29+
LL | pub _c: i64,
30+
| ^^^^^^
4331
|
4432
= help: consider removing the underscore, or making the field private
4533

4634
error: field marked as public but also inferred as unused because it's prefixed with `_`
47-
--> $DIR/pub_underscore_fields.rs:40:13
35+
--> $DIR/pub_underscore_fields.rs:30:9
4836
|
49-
LL | pub(super) _b: u8,
50-
| ^^^^^^^^^^^^^
37+
LL | pub _e: Option<u8>,
38+
| ^^^^^^
5139
|
5240
= help: consider removing the underscore, or making the field private
5341

5442
error: field marked as public but also inferred as unused because it's prefixed with `_`
55-
--> $DIR/pub_underscore_fields.rs:48:13
43+
--> $DIR/pub_underscore_fields.rs:43:9
5644
|
57-
LL | pub(in super::inner) _f: Option<()>,
58-
| ^^^^^^^^^^^^^^^^^^^^^^^
45+
LL | pub(crate) _b: Option<String>,
46+
| ^^^^^^^^^^^^^
5947
|
6048
= help: consider removing the underscore, or making the field private
6149

62-
error: aborting due to 8 previous errors
50+
error: aborting due to 6 previous errors
6351

64-
For more information about this error, try `rustc --explain E0433`.

0 commit comments

Comments
 (0)