This PR fixes the failures currently being experienced on the Bitcoin Core appveyor CI job.
The cause of the failure is the appveyor image being updated to version Visual Studio 2019 16.4. From the v16.4 release notes at https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes it's not clear why the nodiscard warning behaviour has changed.