Geoffrey Irving
Geoffrey Irving

Reputation: 6613

Automatically detect unnecessary ocaml open statements

Say I have a bunch of ocaml modules with various open statements between them. Some of these opens are unnecessary: they pull in a module but then never use any of the symbols.

Is there a programmatic way of finding these unnecessary imports?

Upvotes: 2

Views: 52

Answers (1)

Drup
Drup

Reputation: 3739

Yes, Warning 33. See the list here or with ocamlc -warn-help.

To enable it, add -w +33 to the compiler's command line. With ocamlbuild, add true: warn(+33) to your _tags.

Upvotes: 4

Related Questions