Don't use Optional::hasValue (NFC)

This patch replaces x.hasValue() with x where x is contextually
convertible to bool.

GitOrigin-RevId: 94460f513654da2ee6e759db2804e73001818de5
2 files changed