Hoist the 'forRepl' check out of 'whenVanillaLib' & friends.

Makes it more clear what is going on.

Fixes #1715.
Formatting.