rt: Handle non-integer RUST_THREADS (slightly) more gracefully.

Previously it would call Option.unwrap(), which calls `fail!` on None,
which doesn't work without the runtime (e.g. when initialising it).
rt: use sugary functions rather than manual range loops.
rt: remove a series of unfortunate casts.