Skip to content

Commit 6adc1ad

Browse files
committed
foldme; backtrack, don't repeat the limit const
Signed-off-by: Daniel Silverstone <[email protected]>
1 parent bc43a0b commit 6adc1ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dist/dist.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,9 @@ fn update_from_dist_<'a>(
622622
// The limit of 21 days is an arbitrary selection, so we let the user override it.
623623
const BACKTRACK_LIMIT_DEFAULT: i32 = 21;
624624
let provided = env::var("RUSTUP_BACKTRACK_LIMIT")
625-
.unwrap_or_else(|_| format!("{}", BACKTRACK_LIMIT_DEFAULT));
626-
let provided = provided.parse().unwrap_or(BACKTRACK_LIMIT_DEFAULT);
625+
.ok()
626+
.and_then(|v| v.parse().ok())
627+
.unwrap_or(BACKTRACK_LIMIT_DEFAULT);
627628
Some(if provided < 1 { 1 } else { provided })
628629
};
629630

0 commit comments

Comments
 (0)