Skip to content

Commit 308ceee

Browse files
committed
Auto merge of #13205 - weihanglo:install, r=hi-rustin
fix: clarify `--path` is the installation source not destination ### What does this PR try to resolve? There is a misunderstanding of “default location” mentioned in `cargo install --help`. I don't think one-line explanation helps much there, So remove that imprecise description. This PR also add more "from" for places mentioning installation sources. ### How should we test and review this PR? Read the new help text.
2 parents 4e792c2 + eb8870f commit 308ceee

File tree

10 files changed

+25
-24
lines changed

10 files changed

+25
-24
lines changed

src/bin/cargo/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ Rust's package manager
569569
<cyan,bold>update</> Update dependencies listed in Cargo.lock
570570
<cyan,bold>search</> Search registry for crates
571571
<cyan,bold>publish</> Package and upload this package to the registry
572-
<cyan,bold>install</> Install a Rust binary. Default location is $HOME/.cargo/bin
572+
<cyan,bold>install</> Install a Rust binary
573573
<cyan,bold>uninstall</> Uninstall a Rust binary
574574
<cyan>...</> See all commands with <cyan,bold>--list</>
575575

src/bin/cargo/commands/install.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use cargo_util::paths;
1515

1616
pub fn cli() -> Command {
1717
subcommand("install")
18-
.about("Install a Rust binary. Default location is $HOME/.cargo/bin")
18+
.about("Install a Rust binary")
1919
.arg(
2020
Arg::new("crate")
2121
.value_name("CRATE[@<VER>]")
@@ -63,7 +63,7 @@ pub fn cli() -> Command {
6363
.requires("git"),
6464
)
6565
.arg(
66-
opt("path", "Filesystem path to local crate to install")
66+
opt("path", "Filesystem path to local crate to install from")
6767
.value_name("PATH")
6868
.conflicts_with_all(&["git", "index", "registry"]),
6969
)

src/cargo/ops/cargo_install.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ impl<'cfg> InstallablePackage<'cfg> {
210210
if from_cwd {
211211
if pkg.manifest().edition() == Edition::Edition2015 {
212212
config.shell().warn(
213-
"Using `cargo install` to install the binaries for the \
213+
"Using `cargo install` to install the binaries from the \
214214
package in current working directory is deprecated, \
215215
use `cargo install --path .` instead. \
216216
Use `cargo build` if you want to simply build the package.",
217217
)?
218218
} else {
219219
bail!(
220-
"Using `cargo install` to install the binaries for the \
220+
"Using `cargo install` to install the binaries from the \
221221
package in current working directory is no longer supported, \
222222
use `cargo install --path .` instead. \
223223
Use `cargo build` if you want to simply build the package."

src/doc/man/cargo-install.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ installed, and all executables are installed into the installation root's
2424
{{> description-install-root }}
2525

2626
There are multiple sources from which a crate can be installed. The default
27-
location is crates.io but the `--git`, `--path`, and `--registry` flags can
28-
change this source. If the source contains more than one package (such as
27+
source location is crates.io but the `--git`, `--path`, and `--registry` flags
28+
can change this source. If the source contains more than one package (such as
2929
crates.io or a git repository with multiple crates) the _crate_ argument is
3030
required to indicate which crate should be installed.
3131

@@ -114,7 +114,7 @@ Specific commit to use when installing from git.
114114
{{/option}}
115115

116116
{{#option "`--path` _path_" }}
117-
Filesystem path to local crate to install.
117+
Filesystem path to local crate to install from.
118118
{{/option}}
119119

120120
{{#option "`--list`" }}

src/doc/man/generated_txt/cargo-install.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ DESCRIPTION
3030
o $HOME/.cargo
3131

3232
There are multiple sources from which a crate can be installed. The
33-
default location is crates.io but the --git, --path, and --registry
34-
flags can change this source. If the source contains more than one
35-
package (such as crates.io or a git repository with multiple crates) the
36-
crate argument is required to indicate which crate should be installed.
33+
default source location is crates.io but the --git, --path, and
34+
--registry flags can change this source. If the source contains more
35+
than one package (such as crates.io or a git repository with multiple
36+
crates) the crate argument is required to indicate which crate should be
37+
installed.
3738

3839
Crates from crates.io can optionally specify the version they wish to
3940
install via the --version flags, and similarly packages from git
@@ -114,7 +115,7 @@ OPTIONS
114115
Specific commit to use when installing from git.
115116

116117
--path path
117-
Filesystem path to local crate to install.
118+
Filesystem path to local crate to install from.
118119

119120
--list
120121
List all installed packages and their versions.

src/doc/src/commands/cargo-install.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ The installation root is determined, in order of precedence:
2626
- `$HOME/.cargo`
2727

2828
There are multiple sources from which a crate can be installed. The default
29-
location is crates.io but the `--git`, `--path`, and `--registry` flags can
30-
change this source. If the source contains more than one package (such as
29+
source location is crates.io but the `--git`, `--path`, and `--registry` flags
30+
can change this source. If the source contains more than one package (such as
3131
crates.io or a git repository with multiple crates) the _crate_ argument is
3232
required to indicate which crate should be installed.
3333

@@ -117,7 +117,7 @@ treated as a caret requirement like Cargo dependencies are.</dd>
117117

118118

119119
<dt class="option-term" id="option-cargo-install---path"><a class="option-anchor" href="#option-cargo-install---path"></a><code>--path</code> <em>path</em></dt>
120-
<dd class="option-desc">Filesystem path to local crate to install.</dd>
120+
<dd class="option-desc">Filesystem path to local crate to install from.</dd>
121121

122122

123123
<dt class="option-term" id="option-cargo-install---list"><a class="option-anchor" href="#option-cargo-install---list"></a><code>--list</code></dt>

src/etc/man/cargo-install.1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ The installation root is determined, in order of precedence:
4242
.RE
4343
.sp
4444
There are multiple sources from which a crate can be installed. The default
45-
location is crates.io but the \fB\-\-git\fR, \fB\-\-path\fR, and \fB\-\-registry\fR flags can
46-
change this source. If the source contains more than one package (such as
45+
source location is crates.io but the \fB\-\-git\fR, \fB\-\-path\fR, and \fB\-\-registry\fR flags
46+
can change this source. If the source contains more than one package (such as
4747
crates.io or a git repository with multiple crates) the \fIcrate\fR argument is
4848
required to indicate which crate should be installed.
4949
.sp
@@ -143,7 +143,7 @@ Specific commit to use when installing from git.
143143
.sp
144144
\fB\-\-path\fR \fIpath\fR
145145
.RS 4
146-
Filesystem path to local crate to install.
146+
Filesystem path to local crate to install from.
147147
.RE
148148
.sp
149149
\fB\-\-list\fR

tests/testsuite/cargo/help/stdout.log

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Commands:
3333
update Update dependencies listed in Cargo.lock
3434
search Search registry for crates
3535
publish Package and upload this package to the registry
36-
install Install a Rust binary. Default location is $HOME/.cargo/bin
36+
install Install a Rust binary
3737
uninstall Uninstall a Rust binary
3838
... See all commands with --list
3939

tests/testsuite/cargo_install/help/stdout.log

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Install a Rust binary. Default location is $HOME/.cargo/bin
1+
Install a Rust binary
22

33
Usage: cargo[EXE] install [OPTIONS] [CRATE[@<VER>]]...
44

@@ -13,7 +13,7 @@ Options:
1313
--branch <BRANCH> Branch to use when installing from git
1414
--tag <TAG> Tag to use when installing from git
1515
--rev <SHA> Specific commit to use when installing from git
16-
--path <PATH> Filesystem path to local crate to install
16+
--path <PATH> Filesystem path to local crate to install from
1717
--root <DIR> Directory to install packages into
1818
-f, --force Force overwriting existing crates or binaries
1919
--no-track Do not save tracking information

tests/testsuite/install.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ fn installs_from_cwd_by_default() {
11951195

11961196
p.cargo("install")
11971197
.with_stderr_contains(
1198-
"warning: Using `cargo install` to install the binaries for the \
1198+
"warning: Using `cargo install` to install the binaries from the \
11991199
package in current working directory is deprecated, \
12001200
use `cargo install --path .` instead. \
12011201
Use `cargo build` if you want to simply build the package.",
@@ -1223,7 +1223,7 @@ fn installs_from_cwd_with_2018_warnings() {
12231223
p.cargo("install")
12241224
.with_status(101)
12251225
.with_stderr_contains(
1226-
"error: Using `cargo install` to install the binaries for the \
1226+
"error: Using `cargo install` to install the binaries from the \
12271227
package in current working directory is no longer supported, \
12281228
use `cargo install --path .` instead. \
12291229
Use `cargo build` if you want to simply build the package.",

0 commit comments

Comments
 (0)