Compiler help for dead code warnings


Say that I have

fn foo() { bar() }
fn bar() { qux() }
fn qux() { unimplemented!() }

If I never call foo(), I get dead code warnings for foo(), bar(), and qux(), but the warnings don’t tell me which one dominates. That means my code doesn’t compile if I remove qux() or change to fn _qux().

Is there a way other than just looking at my code to tell that #[allow(dead_code)] for foo() will eliminate all the dead code warnings?

1 Like