Skip to content

Commit 8dd6fac

Browse files
committed
don't return suggestion message if no changes detected
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent f521b4c commit 8dd6fac

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/bootstrap/src/bin/main.rs

+17-15
Original file line numberDiff line numberDiff line change
@@ -158,25 +158,27 @@ fn check_version(config: &Config) -> Option<String> {
158158

159159
let changes = find_recent_config_change_ids(id);
160160

161-
if !changes.is_empty() {
162-
msg.push_str("There have been changes to x.py since you last updated:\n");
163-
164-
for change in changes {
165-
msg.push_str(&format!(" [{}] {}\n", change.severity.to_string(), change.summary));
166-
msg.push_str(&format!(
167-
" - PR Link https://github.com/rust-lang/rust/pull/{}\n",
168-
change.change_id
169-
));
170-
}
161+
if changes.is_empty() {
162+
return None;
163+
}
164+
165+
msg.push_str("There have been changes to x.py since you last updated:\n");
171166

172-
msg.push_str("NOTE: to silence this warning, ");
167+
for change in changes {
168+
msg.push_str(&format!(" [{}] {}\n", change.severity.to_string(), change.summary));
173169
msg.push_str(&format!(
174-
"update `config.toml` to use `change-id = {latest_change_id}` instead"
170+
" - PR Link https://github.com/rust-lang/rust/pull/{}\n",
171+
change.change_id
175172
));
173+
}
176174

177-
if io::stdout().is_terminal() && !config.dry_run() {
178-
t!(fs::write(warned_id_path, latest_change_id.to_string()));
179-
}
175+
msg.push_str("NOTE: to silence this warning, ");
176+
msg.push_str(&format!(
177+
"update `config.toml` to use `change-id = {latest_change_id}` instead"
178+
));
179+
180+
if io::stdout().is_terminal() && !config.dry_run() {
181+
t!(fs::write(warned_id_path, latest_change_id.to_string()));
180182
}
181183
} else {
182184
msg.push_str("WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n");

0 commit comments

Comments
 (0)