Clean up rustc warnings.

These are basically all straightforward changes and should not impact behavior of the language.
I think this is ok to move to `cfg(unix)`, this looks like it just wouldn't compile on android anyway.