Use == instead of match for tests against a single enum value

The performance of using == should now equal that of match, so many
identity methods can be simplified to a single line.

Fixes #1596.