I found out that I have some dead code in my code base but a not getting a dead code warning as expected. I read the Visibility and Privacy article from the rust book. I am following the example on creating a "helper module" with code to be used in the crate but not exposed in the public API.
Here is a simplified example of what I think is happening:
// private module for in-crate usage only
mod foo {
// everything in the module is pub
pub struct Foo {}
impl Foo {
// I expect to see a dead code warning here. Where is it? ...
pub fn dead_code() {}
}
}
use foo::Foo;
// Uh oh, I'm leaking my helper module here!
// But I'm having trouble finding where this occurs in my large code base :(
pub fn get_foo() -> Foo {
Foo {}
}
My question: How do I find the code (get_foo
) that is "leaking" as public what I intended to be crate-public (Foo
)? In a real example, there could be one "leak" that has a domino effect of leaking related types.