The difference between "should be safe if your ocaml code is good" and "is safe" is the thing that allows you to use tooling to delete the code.
Otherwise the best you can do is lint and rely on a human to use their best judgement about whether to remove it or not.