Auto merge of #118789 - jyn514:dry-run, r=onur-ozkan

fix --dry-run when the change-id warning is printed

previously:
```
Building bootstrap
   Compiling bootstrap v0.0.0 (/home/jyn/src/rust2/src/bootstrap)
    Finished dev [unoptimized] target(s) in 4.23s
thread 'main' panicked at src/bin/main.rs:147:17:
fs::write(warned_id_path, latest_change_id.to_string()) failed with No such file or directory (os error 2)
```
This commit is contained in:
bors 2023-12-14 13:30:48 +00:00
commit 529047cfc3
2 changed files with 2 additions and 2 deletions

View File

@ -174,7 +174,7 @@ fn check_version(config: &Config) -> Option<String> {
"update `config.toml` to use `change-id = {latest_change_id}` instead"
));
if io::stdout().is_terminal() {
if io::stdout().is_terminal() && !config.dry_run() {
t!(fs::write(warned_id_path, latest_change_id.to_string()));
}
}

View File

@ -1969,7 +1969,7 @@ impl Config {
config
}
pub(crate) fn dry_run(&self) -> bool {
pub fn dry_run(&self) -> bool {
match self.dry_run {
DryRun::Disabled => false,
DryRun::SelfCheck | DryRun::UserSelected => true,