From 7b564d80c9c706608e6922dfb0e2696402f3da70 Mon Sep 17 00:00:00 2001 From: Matt Harding Date: Sun, 19 Feb 2023 10:54:17 +0000 Subject: [PATCH] Improve "rustc show" output order --- src/cli/rustup_mode.rs | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index a8b36567aef..92edbd20fc8 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -1115,8 +1115,8 @@ fn show(cfg: &Cfg, m: &ArgMatches<'_>) -> Result { }; let show_installed_toolchains = installed_toolchains.len() > 1; - let show_active_targets = active_targets.len() > 1; let show_active_toolchain = true; + let show_active_targets = active_targets.len() > 1; // Only need to display headers if we have multiple sections let show_headers = [ @@ -1158,26 +1158,6 @@ fn show(cfg: &Cfg, m: &ArgMatches<'_>) -> Result { }; } - if show_active_targets { - let mut t = term2::stdout(); - if show_headers { - print_header::(&mut t, "installed targets for active toolchain")?; - } - for at in active_targets { - writeln!( - t, - "{}", - at.component - .target - .as_ref() - .expect("rust-std should have a target") - )?; - } - if show_headers { - writeln!(t)?; - }; - } - if show_active_toolchain { let mut t = term2::stdout(); if show_headers { @@ -1214,6 +1194,26 @@ fn show(cfg: &Cfg, m: &ArgMatches<'_>) -> Result { } } + if show_active_targets { + let mut t = term2::stdout(); + if show_headers { + print_header::(&mut t, "installed targets for active toolchain")?; + } + for at in active_targets { + writeln!( + t, + "{}", + at.component + .target + .as_ref() + .expect("rust-std should have a target") + )?; + } + if show_headers { + writeln!(t)?; + }; + } + fn print_header(t: &mut term2::StdoutTerminal, s: &str) -> std::result::Result<(), E> where E: From + From,