Skip to content

Commit d21c228

Browse files
committed
Auto merge of #9727 - ehuss:fix-version, r=alexcrichton
Fix version string. The version string for `cargo version` was inadvertently changed in #9657 so that it does not include the leading `cargo` as in `cargo 1.53.0 (4369396 2021-04-27)`.
2 parents 9bc7a37 + fdc398e commit d21c228

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/bin/cargo/cli.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ Run with 'cargo -Z [FLAG] [SUBCOMMAND]'",
137137

138138
pub fn get_version_string(is_verbose: bool) -> String {
139139
let version = cargo::version();
140-
let mut version_string = version.to_string();
141-
version_string.push('\n');
140+
let mut version_string = format!("cargo {}\n", version);
142141
if is_verbose {
143142
version_string.push_str(&format!(
144143
"release: {}.{}.{}\n",

tests/testsuite/version.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ fn simple() {
77
let p = project().build();
88

99
p.cargo("version")
10-
.with_stdout(&format!("{}\n", cargo::version()))
10+
.with_stdout(&format!("cargo {}\n", cargo::version()))
1111
.run();
1212

1313
p.cargo("--version")
14-
.with_stdout(&format!("{}\n", cargo::version()))
14+
.with_stdout(&format!("cargo {}\n", cargo::version()))
1515
.run();
1616
}
1717

0 commit comments

Comments
 (0)