Skip to content

Use cargo dev setup toolchain in install from source docs #14766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions book/src/development/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,42 +145,32 @@ unclear to you.
If you are hacking on Clippy and want to install it from source, do the
following:

First, take note of the toolchain
[override](https://rust-lang.github.io/rustup/overrides.html) in
`/rust-toolchain.toml`. We will use this override to install Clippy into the right
toolchain.

> Tip: You can view the active toolchain for the current directory with `rustup
> show active-toolchain`.

From the Clippy project root, run the following command to build the Clippy
binaries and copy them into the toolchain directory. This will override the
currently installed Clippy component.
binaries and copy them into the toolchain directory. This will create a new
toolchain called `clippy` by default, see `cargo dev setup toolchain --help`
for other options.

```terminal
cargo build --release --bin cargo-clippy --bin clippy-driver -Zunstable-options --out-dir "$(rustc --print=sysroot)/bin"
cargo dev setup toolcahin
```

Now you may run `cargo clippy` in any project, using the toolchain where you
just installed Clippy.
Now you may run `cargo +clippy clippy` in any project using the new toolchain.

```terminal
cd my-project
cargo +nightly-2021-07-01 clippy
cargo +clippy clippy
```

...or `clippy-driver`

```terminal
clippy-driver +nightly-2021-07-01 <filename>
clippy-driver +clippy <filename>
```

If you need to restore the default Clippy installation, run the following (from
the Clippy project root).
If you no longer need the toolchain it can be uninstalled using `rustup`:

```terminal
rustup component remove clippy
rustup component add clippy
rustup toolchain uninstall clippy
```

> **DO NOT** install using `cargo install --path . --force` since this will
Expand Down