Assorted cleanups

@pcwalton r?

Might conflict with the rust upgrade - I can rebase later.