From fdc398e743df6e722e461814ea4e28743167c1a4 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 26 Jul 2021 12:18:22 -0700 Subject: [PATCH] Fix version string. --- src/bin/cargo/cli.rs | 3 +-- tests/testsuite/version.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/bin/cargo/cli.rs b/src/bin/cargo/cli.rs index 1fa8c9b9c7a..2fefa8a2d02 100644 --- a/src/bin/cargo/cli.rs +++ b/src/bin/cargo/cli.rs @@ -137,8 +137,7 @@ Run with 'cargo -Z [FLAG] [SUBCOMMAND]'", pub fn get_version_string(is_verbose: bool) -> String { let version = cargo::version(); - let mut version_string = version.to_string(); - version_string.push('\n'); + let mut version_string = format!("cargo {}\n", version); if is_verbose { version_string.push_str(&format!( "release: {}.{}.{}\n", diff --git a/tests/testsuite/version.rs b/tests/testsuite/version.rs index 7186f0c38b6..911b2360b0f 100644 --- a/tests/testsuite/version.rs +++ b/tests/testsuite/version.rs @@ -7,11 +7,11 @@ fn simple() { let p = project().build(); p.cargo("version") - .with_stdout(&format!("{}\n", cargo::version())) + .with_stdout(&format!("cargo {}\n", cargo::version())) .run(); p.cargo("--version") - .with_stdout(&format!("{}\n", cargo::version())) + .with_stdout(&format!("cargo {}\n", cargo::version())) .run(); }