Convert statics to constants

This pr fixes the compile failure with latest `rustc`.

As a bonus, this pr contains fixes for some warnings.
The rule of thumb is actually "use `const` until the compiler complains at you", I just forgot to change a few extra `static`s to `const` in the rust repo.