From 8dd6faca463bfd35a7c47353de69c40d6e054855 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Tue, 26 Dec 2023 15:46:39 +0300 Subject: don't return suggestion message if no changes detected Signed-off-by: onur-ozkan --- src/bootstrap/src/bin/main.rs | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index b1ab8dae535..a44e7c75a14 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -158,25 +158,27 @@ fn check_version(config: &Config) -> Option { let changes = find_recent_config_change_ids(id); - if !changes.is_empty() { - msg.push_str("There have been changes to x.py since you last updated:\n"); - - for change in changes { - msg.push_str(&format!(" [{}] {}\n", change.severity.to_string(), change.summary)); - msg.push_str(&format!( - " - PR Link https://github.com/rust-lang/rust/pull/{}\n", - change.change_id - )); - } + if changes.is_empty() { + return None; + } + + msg.push_str("There have been changes to x.py since you last updated:\n"); - msg.push_str("NOTE: to silence this warning, "); + for change in changes { + msg.push_str(&format!(" [{}] {}\n", change.severity.to_string(), change.summary)); msg.push_str(&format!( - "update `config.toml` to use `change-id = {latest_change_id}` instead" + " - PR Link https://github.com/rust-lang/rust/pull/{}\n", + change.change_id )); + } - if io::stdout().is_terminal() && !config.dry_run() { - t!(fs::write(warned_id_path, latest_change_id.to_string())); - } + msg.push_str("NOTE: to silence this warning, "); + msg.push_str(&format!( + "update `config.toml` to use `change-id = {latest_change_id}` instead" + )); + + if io::stdout().is_terminal() && !config.dry_run() { + t!(fs::write(warned_id_path, latest_change_id.to_string())); } } else { 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"); -- cgit 1.4.1-3-g733a5