clang: Fix warnings about unused variables

I happen to build with clang and stumble upon a bunch of warnings. This ticket is to fix them all. See associated MR.