rust: Make --test flag to rustc configurable

The `--test` flag is usually desirable for checking Rust code, but in
certain cases (like when `#![no_std]` is used in the current file) it
causes unexpected and difficult-to-trace errors in the checker.