X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=README.md;h=1193771ff736b2471ca8a224098e80ed24efeff4;hb=4c5f23082aff7c55d32de9869c0c40df94eeae37;hp=de72e8d124d45adb0d083e4e8793e5065cd0d952;hpb=88f5be2041acca3da00648ffc10846dab25cfb5f;p=rust.git diff --git a/README.md b/README.md index de72e8d124d..1193771ff73 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code. -[There are over 500 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html) +[There are over 550 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html) Lints are divided into categories, each with a default [lint level](https://doc.rust-lang.org/rustc/lints/levels.html). You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category. @@ -37,8 +37,8 @@ Table of contents: ## Usage -Below are instructions on how to use Clippy as a subcommand, compiled from source -or in Travis CI. +Below are instructions on how to use Clippy as a cargo subcommand, +in projects that do not use cargo, or in Travis CI. ### As a cargo subcommand (`cargo clippy`) @@ -98,22 +98,18 @@ If you want to run Clippy **only** on the given crate, use the `--no-deps` optio cargo clippy -p example -- --no-deps ``` -### As a rustc replacement (`clippy-driver`) +### Using `clippy-driver` -Clippy can also be used in projects that do not use cargo. To do so, you will need to replace -your `rustc` compilation commands with `clippy-driver`. For example, if your project runs: - -```terminal -rustc --edition 2018 -Cpanic=abort foo.rs -``` - -Then, to enable Clippy, you will need to call: +Clippy can also be used in projects that do not use cargo. To do so, run `clippy-driver` +with the same arguments you use for `rustc`. For example: ```terminal clippy-driver --edition 2018 -Cpanic=abort foo.rs ``` -Note that `rustc` will still run, i.e. it will still emit the output files it normally does. +Note that `clippy-driver` is designed for running Clippy only and should not be used as a general +replacement for `rustc`. `clippy-driver` may produce artifacts that are not optimized as expected, +for example. ### Travis CI @@ -148,7 +144,7 @@ value` mapping e.g. ```toml avoid-breaking-exported-api = false -blacklisted-names = ["toto", "tata", "titi"] +disallowed-names = ["toto", "tata", "titi"] cognitive-complexity-threshold = 30 ``` @@ -218,6 +214,14 @@ specifying the minimum supported Rust version (MSRV) in the clippy configuration msrv = "1.30.0" ``` +Alternatively, the [`rust-version` field](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) +in the `Cargo.toml` can be used. + +```toml +# Cargo.toml +rust-version = "1.30" +``` + The MSRV can also be specified as an inner attribute, like below. ```rust @@ -242,7 +246,7 @@ If you want to contribute to Clippy, you can find more information in [CONTRIBUT ## License -Copyright 2014-2021 The Rust Project Developers +Copyright 2014-2022 The Rust Project Developers Licensed under the Apache License, Version 2.0 or the MIT license