Skip to content

Commit

Permalink
update UI test
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkMyCar committed Feb 3, 2023
1 parent a715ae4 commit b134fe6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 45 deletions.
30 changes: 15 additions & 15 deletions tests/ui/pub_underscore_fields.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#![allow(unused)]
#![warn(clippy::pub_underscore_fields)]

mod inner {
pub struct PubSuper {
pub(super) a: usize,
pub(super) _b: u8,
_c: i32,
}

mod inner2 {
pub struct PubModVisibility {
pub(in crate::inner) e: bool,
pub(in crate::inner) _f: Option<()>,
}
}
}

fn main() {
pub struct StructWithOneViolation {
pub _a: usize,
Expand Down Expand Up @@ -33,19 +48,4 @@ fn main() {
r#pub: bool,
_pub: String,
}

mod inner {
pub struct PubSuper {
pub(super) a: usize,
pub(super) _b: u8,
_c: i32,
}
}

mod inner2 {
pub struct PubModVisibility {
pub(in super::inner) e: bool,
pub(in super::inner) _f: Option<()>,
}
}
}
47 changes: 17 additions & 30 deletions tests/ui/pub_underscore_fields.stderr
Original file line number Diff line number Diff line change
@@ -1,64 +1,51 @@
error[E0433]: failed to resolve: could not find `inner` in the crate root
--> $DIR/pub_underscore_fields.rs:47:27
|
LL | pub(in super::inner) e: bool,
| ^^^^^ could not find `inner` in the crate root

error[E0433]: failed to resolve: could not find `inner` in the crate root
--> $DIR/pub_underscore_fields.rs:48:27
|
LL | pub(in super::inner) _f: Option<()>,
| ^^^^^ could not find `inner` in the crate root

error: field marked as public but also inferred as unused because it's prefixed with `_`
--> $DIR/pub_underscore_fields.rs:6:9
--> $DIR/pub_underscore_fields.rs:7:9
|
LL | pub _a: usize,
| ^^^^^^
LL | pub(super) _b: u8,
| ^^^^^^^^^^^^^
|
= help: consider removing the underscore, or making the field private
= note: `-D clippy::pub-underscore-fields` implied by `-D warnings`

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

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

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

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

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

error: aborting due to 8 previous errors
error: aborting due to 6 previous errors

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

0 comments on commit b134fe6

Please sign in to comment.