diff options
| author | r0cky <mu001999@outlook.com> | 2024-06-05 23:20:09 +0800 |
|---|---|---|
| committer | r0cky <mu001999@outlook.com> | 2024-06-05 23:20:09 +0800 |
| commit | 35130d7233e939cc9a6fd8b72a4baee2eb59c3b2 (patch) | |
| tree | ea13e12817d949301828e9ff4f5775ca8ba9a31e /tests/ui/pub | |
| parent | 2a2c29aafa50bf6fe53d66b32070eba59f860ac3 (diff) | |
| download | rust-35130d7233e939cc9a6fd8b72a4baee2eb59c3b2.tar.gz rust-35130d7233e939cc9a6fd8b72a4baee2eb59c3b2.zip | |
Detect pub structs never constructed and unused associated constants in traits
Diffstat (limited to 'tests/ui/pub')
| -rw-r--r-- | tests/ui/pub/pub-ident-struct-4.fixed | 3 | ||||
| -rw-r--r-- | tests/ui/pub/pub-ident-struct-4.rs | 3 | ||||
| -rw-r--r-- | tests/ui/pub/pub-ident-struct-4.stderr | 6 |
3 files changed, 7 insertions, 5 deletions
diff --git a/tests/ui/pub/pub-ident-struct-4.fixed b/tests/ui/pub/pub-ident-struct-4.fixed index 5fedbb72437..a62ece43ece 100644 --- a/tests/ui/pub/pub-ident-struct-4.fixed +++ b/tests/ui/pub/pub-ident-struct-4.fixed @@ -1,6 +1,7 @@ //@ run-rustfix -pub struct T(#[allow(dead_code)] String); +#[allow(dead_code)] +pub struct T(String); //~^ ERROR missing `struct` for struct definition fn main() {} diff --git a/tests/ui/pub/pub-ident-struct-4.rs b/tests/ui/pub/pub-ident-struct-4.rs index 5c721c25a78..0d56a31beaf 100644 --- a/tests/ui/pub/pub-ident-struct-4.rs +++ b/tests/ui/pub/pub-ident-struct-4.rs @@ -1,6 +1,7 @@ //@ run-rustfix -pub T(#[allow(dead_code)] String); +#[allow(dead_code)] +pub T(String); //~^ ERROR missing `struct` for struct definition fn main() {} diff --git a/tests/ui/pub/pub-ident-struct-4.stderr b/tests/ui/pub/pub-ident-struct-4.stderr index 5fbb02c8673..ec136783211 100644 --- a/tests/ui/pub/pub-ident-struct-4.stderr +++ b/tests/ui/pub/pub-ident-struct-4.stderr @@ -1,12 +1,12 @@ error: missing `struct` for struct definition - --> $DIR/pub-ident-struct-4.rs:3:4 + --> $DIR/pub-ident-struct-4.rs:4:4 | -LL | pub T(#[allow(dead_code)] String); +LL | pub T(String); | ^ | help: add `struct` here to parse `T` as a public struct | -LL | pub struct T(#[allow(dead_code)] String); +LL | pub struct T(String); | ++++++ error: aborting due to 1 previous error |
