Skip to content

Commit ae210ce

Browse files
committed
fix(cli): align rustup show's --verbose behavior with rustup show active-toolchain
1 parent 1fe9366 commit ae210ce

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/cli/rustup_mode.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1045,8 +1045,11 @@ fn show(cfg: &Cfg<'_>, verbose: bool) -> Result<utils::ExitCode> {
10451045
&active_reason,
10461046
)?;
10471047
writeln!(t.lock(), "name: {}", active_toolchain.name())?;
1048-
writeln!(t.lock(), "compiler: {}", active_toolchain.rustc_version())?;
10491048
writeln!(t.lock(), "active because: {}", active_reason)?;
1049+
if verbose {
1050+
writeln!(t.lock(), "compiler: {}", active_toolchain.rustc_version())?;
1051+
writeln!(t.lock(), "path: {}", active_toolchain.path().display())?;
1052+
}
10501053

10511054
// show installed targets for the active toolchain
10521055
writeln!(t.lock(), "installed targets:")?;

tests/suite/cli_rustup.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,6 @@ nightly-{0} (active, default)
661661
active toolchain
662662
----------------
663663
name: nightly-{0}
664-
compiler: 1.3.0 (hash-nightly-2)
665664
active because: it's the default toolchain
666665
installed targets:
667666
{0}
@@ -735,7 +734,6 @@ nightly-{0} (active, default)
735734
active toolchain
736735
----------------
737736
name: nightly-{0}
738-
compiler: 1.3.0 (hash-nightly-2)
739737
active because: it's the default toolchain
740738
installed targets:
741739
{0}
@@ -774,7 +772,6 @@ nightly-{0} (active, default)
774772
active toolchain
775773
----------------
776774
name: nightly-{0}
777-
compiler: 1.3.0 (xxxx-nightly-2)
778775
active because: it's the default toolchain
779776
installed targets:
780777
{1}
@@ -831,7 +828,6 @@ nightly-{0} (active, default)
831828
active toolchain
832829
----------------
833830
name: nightly-{0}
834-
compiler: 1.3.0 (xxxx-nightly-2)
835831
active because: it's the default toolchain
836832
installed targets:
837833
{1}
@@ -1139,7 +1135,6 @@ nightly-{0} (active, default)
11391135
active toolchain
11401136
----------------
11411137
name: nightly-{0}
1142-
compiler: 1.3.0 (hash-nightly-2)
11431138
active because: overridden by environment variable RUSTUP_TOOLCHAIN
11441139
installed targets:
11451140
{0}
@@ -1227,11 +1222,17 @@ nightly-2015-01-01-{0}
12271222
active toolchain
12281223
----------------
12291224
name: nightly-{0}
1230-
compiler: 1.3.0 (hash-nightly-2)
12311225
active because: it's the default toolchain
1226+
compiler: 1.3.0 (hash-nightly-2)
1227+
path: {2}
12321228
installed targets:
12331229
{0}
1234-
"
1230+
",
1231+
config
1232+
.rustupdir
1233+
.join("toolchains")
1234+
.join(for_host!("nightly-{0}"))
1235+
.display()
12351236
),
12361237
r"",
12371238
)

0 commit comments

Comments
 (0)