Skip to content

Commit e22928c

Browse files
authored
Merge pull request #2921 from yaahallo/master
Update readme for new clippy install method
2 parents 2a01689 + 29cae62 commit e22928c

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,44 +35,45 @@ Table of contents:
3535
Since this is a tool for helping the developer of a library or application
3636
write better code, it is recommended not to include Clippy as a hard dependency.
3737
Options include using it as an optional dependency, as a cargo subcommand, or
38-
as an included feature during build. All of these options are detailed below.
38+
as an included feature during build. These options are detailed below.
3939

40-
As a general rule Clippy will only work with the *latest* Rust nightly for now.
40+
### As a cargo subcommand (`cargo clippy`)
4141

42-
To install Rust nightly, the recommended way is to use [rustup](https://rustup.rs/):
42+
One way to use Clippy is by installing Clippy through rustup as a cargo
43+
subcommand.
4344

44-
```terminal
45-
rustup install nightly
46-
```
45+
#### Step 1: Install rustup
4746

48-
### As a cargo subcommand (`cargo clippy`)
47+
You can install [rustup](http://rustup.rs/) on supported platforms. This will help
48+
us install clippy and its dependencies.
4949

50-
One way to use Clippy is by installing Clippy through cargo as a cargo
51-
subcommand.
50+
If you already have rustup installed, update to ensure you have the latest
51+
rustup and compiler:
5252

5353
```terminal
54-
cargo +nightly install clippy
54+
rustup update
5555
```
5656

57-
(The `+nightly` is not necessary if your default `rustup` install is nightly)
57+
#### Step 2: Install nightly toolchain
5858

59-
Now you can run Clippy by invoking `cargo +nightly clippy`.
59+
As a general rule Clippy will only work with the *latest* Rust nightly for now.
6060

61-
To update the subcommand together with the latest nightly use the [rust-update](rust-update) script or run:
61+
To install Rust nightly with [rustup](https://rustup.rs/):
6262

6363
```terminal
64-
rustup update nightly
65-
cargo +nightly install --force clippy
64+
rustup install nightly
6665
```
6766

68-
In case you are not using rustup, you need to set the environment flag
69-
`SYSROOT` during installation so Clippy knows where to find `librustc` and
70-
similar crates.
67+
#### Step 3: Install clippy
68+
69+
Once you have rustup and the nightly toolchain installed, run the following command:
7170

7271
```terminal
73-
SYSROOT=/path/to/rustc/sysroot cargo install clippy
72+
rustup component add clippy-preview --toolchain=nightly
7473
```
7574

75+
Now you can run Clippy by invoking `cargo +nightly clippy`.
76+
7677
### Running Clippy from the command line without installing it
7778

7879
To have cargo compile your crate with Clippy without Clippy installation

0 commit comments

Comments
 (0)