diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index 066e900ad46..31ceb737cd4 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -142,7 +142,7 @@ pub trait AppExt: Sized { } fn arg_release(self, release: &'static str) -> Self { - self._arg(opt("release", release)) + self._arg(opt("release", release).short("r")) } fn arg_profile(self, profile: &'static str) -> Self { diff --git a/src/doc/man/generated_txt/cargo-build.txt b/src/doc/man/generated_txt/cargo-build.txt index 4aa746e95fd..505c26d2c00 100644 --- a/src/doc/man/generated_txt/cargo-build.txt +++ b/src/doc/man/generated_txt/cargo-build.txt @@ -142,7 +142,7 @@ OPTIONS documentation for more details. - --release + -r, --release Build optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name. diff --git a/src/doc/man/generated_txt/cargo-check.txt b/src/doc/man/generated_txt/cargo-check.txt index 28befe66d23..b0055fc3a15 100644 --- a/src/doc/man/generated_txt/cargo-check.txt +++ b/src/doc/man/generated_txt/cargo-check.txt @@ -148,7 +148,7 @@ OPTIONS documentation for more details. - --release + -r, --release Check optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name. diff --git a/src/doc/man/generated_txt/cargo-doc.txt b/src/doc/man/generated_txt/cargo-doc.txt index 820eed38e0a..6ce5c719a5a 100644 --- a/src/doc/man/generated_txt/cargo-doc.txt +++ b/src/doc/man/generated_txt/cargo-doc.txt @@ -126,7 +126,7 @@ OPTIONS documentation for more details. - --release + -r, --release Document optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name. diff --git a/src/doc/man/generated_txt/cargo-fix.txt b/src/doc/man/generated_txt/cargo-fix.txt index e96c2b01247..3416a2079d5 100644 --- a/src/doc/man/generated_txt/cargo-fix.txt +++ b/src/doc/man/generated_txt/cargo-fix.txt @@ -221,7 +221,7 @@ OPTIONS documentation for more details. - --release + -r, --release Fix optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name. diff --git a/src/doc/man/generated_txt/cargo-run.txt b/src/doc/man/generated_txt/cargo-run.txt index f159a7a0ebc..59e4ab1f7fc 100644 --- a/src/doc/man/generated_txt/cargo-run.txt +++ b/src/doc/man/generated_txt/cargo-run.txt @@ -71,7 +71,7 @@ OPTIONS documentation for more details. - --release + -r, --release Run optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name. diff --git a/src/doc/man/generated_txt/cargo-rustc.txt b/src/doc/man/generated_txt/cargo-rustc.txt index f39d83626de..bf282c2c04d 100644 --- a/src/doc/man/generated_txt/cargo-rustc.txt +++ b/src/doc/man/generated_txt/cargo-rustc.txt @@ -133,7 +133,7 @@ OPTIONS documentation for more details. - --release + -r, --release Build optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name. diff --git a/src/doc/man/generated_txt/cargo-rustdoc.txt b/src/doc/man/generated_txt/cargo-rustdoc.txt index 857d0c0fde3..a3e977ef423 100644 --- a/src/doc/man/generated_txt/cargo-rustdoc.txt +++ b/src/doc/man/generated_txt/cargo-rustdoc.txt @@ -142,7 +142,7 @@ OPTIONS documentation for more details. - --release + -r, --release Document optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name. diff --git a/src/doc/man/generated_txt/cargo-test.txt b/src/doc/man/generated_txt/cargo-test.txt index 599bbd075fd..028ccd9fa09 100644 --- a/src/doc/man/generated_txt/cargo-test.txt +++ b/src/doc/man/generated_txt/cargo-test.txt @@ -219,7 +219,7 @@ OPTIONS documentation for more details. - --release + -r, --release Test optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name. diff --git a/src/doc/man/includes/options-release.md b/src/doc/man/includes/options-release.md index ad77c274e4a..723dbba9f38 100644 --- a/src/doc/man/includes/options-release.md +++ b/src/doc/man/includes/options-release.md @@ -1,4 +1,4 @@ -{{#option "`--release`"}} +{{#option "`-r`" "`--release`"}} {{actionverb}} optimized artifacts with the `release` profile. See also the `--profile` option for choosing a specific profile by name. {{/option}} diff --git a/src/doc/src/commands/cargo-build.md b/src/doc/src/commands/cargo-build.md index 357f3d56120..0f8e7dc79bf 100644 --- a/src/doc/src/commands/cargo-build.md +++ b/src/doc/src/commands/cargo-build.md @@ -181,6 +181,7 @@ target artifacts are placed in a separate directory. See the +
-r
--release
Build optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name.
diff --git a/src/doc/src/commands/cargo-check.md b/src/doc/src/commands/cargo-check.md index 70cd1bafa6e..29068ef271b 100644 --- a/src/doc/src/commands/cargo-check.md +++ b/src/doc/src/commands/cargo-check.md @@ -186,6 +186,7 @@ target artifacts are placed in a separate directory. See the +
-r
--release
Check optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name.
diff --git a/src/doc/src/commands/cargo-doc.md b/src/doc/src/commands/cargo-doc.md index 19288eaed13..781ba592858 100644 --- a/src/doc/src/commands/cargo-doc.md +++ b/src/doc/src/commands/cargo-doc.md @@ -164,6 +164,7 @@ target artifacts are placed in a separate directory. See the +
-r
--release
Document optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name.
diff --git a/src/doc/src/commands/cargo-fix.md b/src/doc/src/commands/cargo-fix.md index 478eaef1b43..232703f0938 100644 --- a/src/doc/src/commands/cargo-fix.md +++ b/src/doc/src/commands/cargo-fix.md @@ -266,6 +266,7 @@ target artifacts are placed in a separate directory. See the +
-r
--release
Fix optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name.
diff --git a/src/doc/src/commands/cargo-run.md b/src/doc/src/commands/cargo-run.md index c6e3d9a0a8c..92ba311f728 100644 --- a/src/doc/src/commands/cargo-run.md +++ b/src/doc/src/commands/cargo-run.md @@ -99,6 +99,7 @@ target artifacts are placed in a separate directory. See the +
-r
--release
Run optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name.
diff --git a/src/doc/src/commands/cargo-rustc.md b/src/doc/src/commands/cargo-rustc.md index 5601425e6a9..fb89e6ebcfc 100644 --- a/src/doc/src/commands/cargo-rustc.md +++ b/src/doc/src/commands/cargo-rustc.md @@ -168,6 +168,7 @@ target artifacts are placed in a separate directory. See the +
-r
--release
Build optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name.
diff --git a/src/doc/src/commands/cargo-rustdoc.md b/src/doc/src/commands/cargo-rustdoc.md index 719c7f5ca23..493414c864a 100644 --- a/src/doc/src/commands/cargo-rustdoc.md +++ b/src/doc/src/commands/cargo-rustdoc.md @@ -183,6 +183,7 @@ target artifacts are placed in a separate directory. See the +
-r
--release
Document optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name.
diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md index 1bc44e5ebfc..5039ccfad5b 100644 --- a/src/doc/src/commands/cargo-test.md +++ b/src/doc/src/commands/cargo-test.md @@ -262,6 +262,7 @@ target artifacts are placed in a separate directory. See the +
-r
--release
Test optimized artifacts with the release profile. See also the --profile option for choosing a specific profile by name.
diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1 index 832c70686d2..be199d52d18 100644 --- a/src/etc/man/cargo-build.1 +++ b/src/etc/man/cargo-build.1 @@ -169,6 +169,7 @@ target artifacts are placed in a separate directory. See the \fIbuild cache\fR documentation for more details. .RE .sp +\fB\-r\fR, \fB\-\-release\fR .RS 4 Build optimized artifacts with the \fBrelease\fR profile. diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1 index 420a04212e5..4684b2ccdea 100644 --- a/src/etc/man/cargo-check.1 +++ b/src/etc/man/cargo-check.1 @@ -174,6 +174,7 @@ target artifacts are placed in a separate directory. See the \fIbuild cache\fR documentation for more details. .RE .sp +\fB\-r\fR, \fB\-\-release\fR .RS 4 Check optimized artifacts with the \fBrelease\fR profile. diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1 index 5b13991289b..051da4e5031 100644 --- a/src/etc/man/cargo-doc.1 +++ b/src/etc/man/cargo-doc.1 @@ -147,6 +147,7 @@ target artifacts are placed in a separate directory. See the \fIbuild cache\fR documentation for more details. .RE .sp +\fB\-r\fR, \fB\-\-release\fR .RS 4 Document optimized artifacts with the \fBrelease\fR profile. diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1 index 1bb823fe44e..6bea733cb6c 100644 --- a/src/etc/man/cargo-fix.1 +++ b/src/etc/man/cargo-fix.1 @@ -269,6 +269,7 @@ target artifacts are placed in a separate directory. See the \fIbuild cache\fR documentation for more details. .RE .sp +\fB\-r\fR, \fB\-\-release\fR .RS 4 Fix optimized artifacts with the \fBrelease\fR profile. diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1 index ee98a69bfd4..14be91d6dd8 100644 --- a/src/etc/man/cargo-run.1 +++ b/src/etc/man/cargo-run.1 @@ -80,6 +80,7 @@ target artifacts are placed in a separate directory. See the \fIbuild cache\fR documentation for more details. .RE .sp +\fB\-r\fR, \fB\-\-release\fR .RS 4 Run optimized artifacts with the \fBrelease\fR profile. diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1 index f73643102be..197bd30de29 100644 --- a/src/etc/man/cargo-rustc.1 +++ b/src/etc/man/cargo-rustc.1 @@ -155,6 +155,7 @@ target artifacts are placed in a separate directory. See the \fIbuild cache\fR documentation for more details. .RE .sp +\fB\-r\fR, \fB\-\-release\fR .RS 4 Build optimized artifacts with the \fBrelease\fR profile. diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1 index 01c93eeb9e6..697fe3ecd87 100644 --- a/src/etc/man/cargo-rustdoc.1 +++ b/src/etc/man/cargo-rustdoc.1 @@ -166,6 +166,7 @@ target artifacts are placed in a separate directory. See the \fIbuild cache\fR documentation for more details. .RE .sp +\fB\-r\fR, \fB\-\-release\fR .RS 4 Document optimized artifacts with the \fBrelease\fR profile. diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1 index eaa000305d3..aa425416fd6 100644 --- a/src/etc/man/cargo-test.1 +++ b/src/etc/man/cargo-test.1 @@ -266,6 +266,7 @@ target artifacts are placed in a separate directory. See the \fIbuild cache\fR documentation for more details. .RE .sp +\fB\-r\fR, \fB\-\-release\fR .RS 4 Test optimized artifacts with the \fBrelease\fR profile. diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index bd46f400e0b..487965e432e 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -1775,6 +1775,25 @@ fn verbose_release_build() { .run(); } +#[cargo_test] +fn verbose_release_build_short() { + let p = project().file("src/lib.rs", "").build(); + p.cargo("build -v -r") + .with_stderr( + "\ +[COMPILING] foo v0.0.1 ([CWD]) +[RUNNING] `rustc --crate-name foo src/lib.rs [..]--crate-type lib \ + --emit=[..]link[..]\ + -C opt-level=3[..]\ + -C metadata=[..] \ + --out-dir [..] \ + -L dependency=[CWD]/target/release/deps` +[FINISHED] release [optimized] target(s) in [..] +", + ) + .run(); +} + #[cargo_test] fn verbose_release_build_deps() { let p = project() diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 5775e5b8e00..53498caf7cf 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -936,6 +936,29 @@ fn release_works() { assert!(p.release_bin("foo").is_file()); } +#[cargo_test] +fn release_short_works() { + let p = project() + .file( + "src/main.rs", + r#" + fn main() { if cfg!(debug_assertions) { panic!() } } + "#, + ) + .build(); + + p.cargo("run -r") + .with_stderr( + "\ +[COMPILING] foo v0.0.1 ([CWD]) +[FINISHED] release [optimized] target(s) in [..] +[RUNNING] `target/release/foo[EXE]` +", + ) + .run(); + assert!(p.release_bin("foo").is_file()); +} + #[cargo_test] fn run_bin_different_name() { let p = project()