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(); }