1
Fork 0

Check allow_unstable before checking environment variables

This commit is contained in:
Samuel E. Moelius III 2021-09-30 12:57:34 -04:00
parent a6738c7231
commit 32b6ac5b44

View file

@ -339,7 +339,7 @@ fn get_time_options(
fn get_shuffle(matches: &getopts::Matches, allow_unstable: bool) -> OptPartRes<bool> { fn get_shuffle(matches: &getopts::Matches, allow_unstable: bool) -> OptPartRes<bool> {
let mut shuffle = unstable_optflag!(matches, allow_unstable, "shuffle"); let mut shuffle = unstable_optflag!(matches, allow_unstable, "shuffle");
if !shuffle { if !shuffle && allow_unstable {
shuffle = match env::var("RUST_TEST_SHUFFLE") { shuffle = match env::var("RUST_TEST_SHUFFLE") {
Ok(val) => &val != "0", Ok(val) => &val != "0",
Err(_) => false, Err(_) => false,
@ -364,7 +364,7 @@ fn get_shuffle_seed(matches: &getopts::Matches, allow_unstable: bool) -> OptPart
None => None, None => None,
}; };
if shuffle_seed.is_none() { if shuffle_seed.is_none() && allow_unstable {
shuffle_seed = match env::var("RUST_TEST_SHUFFLE_SEED") { shuffle_seed = match env::var("RUST_TEST_SHUFFLE_SEED") {
Ok(val) => match val.parse::<u64>() { Ok(val) => match val.parse::<u64>() {
Ok(n) => Some(n), Ok(n) => Some(n),