Remove unused diagnostic codes.

Fixes #16449.