@@ -35,44 +35,45 @@ Table of contents:
35
35
Since this is a tool for helping the developer of a library or application
36
36
write better code, it is recommended not to include Clippy as a hard dependency.
37
37
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.
39
39
40
- As a general rule Clippy will only work with the * latest * Rust nightly for now.
40
+ ### As a cargo subcommand ( ` cargo clippy ` )
41
41
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.
43
44
44
- ``` terminal
45
- rustup install nightly
46
- ```
45
+ #### Step 1: Install rustup
47
46
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.
49
49
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:
52
52
53
53
``` terminal
54
- cargo +nightly install clippy
54
+ rustup update
55
55
```
56
56
57
- (The ` +nightly ` is not necessary if your default ` rustup ` install is nightly)
57
+ #### Step 2: Install nightly toolchain
58
58
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 .
60
60
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/ ) :
62
62
63
63
``` terminal
64
- rustup update nightly
65
- cargo +nightly install --force clippy
64
+ rustup install nightly
66
65
```
67
66
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:
71
70
72
71
``` terminal
73
- SYSROOT=/path/to/rustc/sysroot cargo install clippy
72
+ rustup component add clippy-preview --toolchain=nightly
74
73
```
75
74
75
+ Now you can run Clippy by invoking ` cargo +nightly clippy ` .
76
+
76
77
### Running Clippy from the command line without installing it
77
78
78
79
To have cargo compile your crate with Clippy without Clippy installation
0 commit comments