1 // Unused `pub` fields in non-`pub` structs should also trigger dead code warnings.
7 a: i32, //~ WARNING: fields `a` and `b` are never read
14 fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used
15 pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used
18 pub(crate) struct Foo1 {
19 a: i32, //~ WARNING: fields `a` and `b` are never read
23 pub(crate) struct Bar1;
26 fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used
27 pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used
30 pub(crate) struct Foo2 {
31 a: i32, //~ WARNING: fields `a` and `b` are never read
35 pub(crate) struct Bar2;
38 fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used
39 pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used
44 let _ = Foo { a: 1, b: 2 };
46 let _ = Foo1 { a: 1, b: 2 };
48 let _ = Foo2 { a: 1, b: 2 };