Use more direct code than mem::replace
Use more direct code than mem::replace

The mem::replace idiom was unneeded, so replace it with more direct
code.

This fixes the lint issues breaking the build on master.

Stebalien/tempfile