No warning on unused type alias

I'm adding a new feature, and the first thing I did is create a type alias. The compiler didn't give me a warning that it wasn't used. Is there a reason?

There must be a little more to it than that. Have an example?

pub type SNAKEY = bool;

I did a global search for SNAKEY and found only the one occurrence. I get the warning if I remove pub.

Because it's pub, maybe someone is using it outside the current file, etc. You also won't get other dead code warnings, like for unused fields or structs, if they are pub.

(I.e. it's not a global analysis.)

1 Like