Skip to content

Commit

Permalink
merge 'upstream_master' into 'master'
Browse files Browse the repository at this point in the history
同步社区最新master分支代码

Created-by: lizheng 30020856
Author-id: 11958
MR-id: 457385
Commit-by: bors;Michael Krasnitski;Mara Bos;KaDiWa;Alex Macleod;Manish Goregaokar;Tyler Weaver;Niki4tap;koka;Sylvain Desodt;ksaleem;Philipp Krones;Collin Styles;xFrednet;Martin Fischer;Evan Typanski;Vincenzo Palazzo;Samuel Moelius;chansuke;Michael Woerister;Kyle Matsuda;Maria José Solano;Michael Goulet;Yuki Okushi;Jason Newcomb;Joshua Nelson;Oli Scherer;Robert Bastian;navh;asquared31415;Andre Bogus;Albert Larsan;dswij;Raiki Tamura;Caio;blyxyas;Robin Schroer;Kyle Huey;Eric Wu;Nilstrieb;Andy Russell;Max Baumann;Ardis Lu;Trevor Gross;Ray Redondo;Matthias Krüger;Esteban Küber;Lukas Lueg;alexey semenyuk;dboso;Samuel Tardieu;feniljain;Gary Guo;Nicholas Nethercote;Fridtjof Stoldt;naosense;alex-semenyuk;Taiki Endo;Hannah Town;Jakob Degen;Lukas Wirth;Vadim Petrochenkov;mdgaziur;Eric Huss;Yuri Astrakhan;kraktus;Ralf Jung;Santiago Pastorino;Camille GILLOT;hkalbasi;Arpad Borsos;Maybe Waffle;ozkanonur;Sosthène Guédon;Deadbeef;Kartavya Vashishtha;Aphek;Nadir Fejzic;Lukas Markeffsky;hrxi;clubby789;yukang;Ryan Scheidter;Grachev Mikhail;Elliot Bobrow;Dylan DPC;Steven Casper;bebecue;Trevor Arjeski;Onur Özkan;Cameron Steffen;Guillaume Gomez;Matthew Ingwersen;Alex ✨ Cosmic Princess ✨;dswijj;mejrs;Rageking8;Alex;est31;oxalica;JT;Doru-Florin Blanzeanu;Andreu Botella;royrustdev;flip1995;lcnr;Kevin Per;Josh Stone;TennyZhuang;Marijn Schouten;Steven Nguyen;Cody;Urgau;ouz-a;Nahua Kang;Felix Kohlgrüber
Merged-by: wangqilin 00349210
E2E-issues: 
Description:
add syntax-tree-patterns RFC,
Remove if_chain from equatable_if_let,
Lint suggests matches macro if PartialEq trait is not implemented,
Run cargo dev bless to update fixes & stderr,
Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup,
Remove `mir::CastKind::Misc`,
Merge commit '8f1ebdd18bdecc621f16baaf779898cc08cc2766' into clippyup,
Introduce TypeErrCtxt

TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't
need to.,
Change InferCtxtBuilder from enter to build,
make const_err a hard error,
Auto merge of #102091 - RalfJung:const_err, r=oli-obk

make const_err a hard error

This lint has been deny-by-default with future incompat wording since [Rust 1.51](rust-lang/rust#80394) and the stable release of this week starts showing it in cargo's future compat reports. I can't wait to finally get rid of at least some of the mess in our const-err-reporting-code. ;)

r? `@oli-obk`
Fixes rust-lang/rust#71800
Fixes rust-lang/rust#100114,
Auto merge of rust-lang#2583 - RalfJung:rustup, r=oli-obk

initial josh subtree sync

This demonstrates what a josh-based rustup would look like with my patched josh. To create it I did
```
git fetch http://localhost:8000/rust-lang/rust.git:start=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git master
git merge FETCH_HEAD
./rustup-toolchain HEAD && ./miri fmt
git commit -am rustup
```
Unlike the [previous attempt](rust-lang/miri#2554), this does not add a new root commit to the repo.

Once we merge this, we committed to using josh for subtree syncing, and in particular a version of josh that includes josh-project/josh#961 (or something compatible).,
Stabilize half_open_range_patterns,
Rollup merge of #102675 - ouz-a:mir-technical-debt, r=oli-obk

Remove `mir::CastKind::Misc`

As discussed in #97649 `mir::CastKind::Misc` is not clear, this PR addresses that by creating a new enum variant for every valid cast.

r? ````@oli-obk````,
[`unnecessary_cast`] Do not lint negative hexadecimal literals when cast as float

Floats cannot be expressed as hexadecimal literals,
ImplItemKind::TyAlias => ImplItemKind::Type,
merge rustc history,
Fix clippy tests that trigger `for_loop_over_fallibles` lint,
fixup lint name,
deprecate `clippy::for_loops_over_fallibles`,
Rollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8Ki

rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`

The naming of this variant seems inconsistent given that this is not really a "type alias", and the associated type variant for `TraitItemKind` is just called `Type`.,
Rollup merge of #102275 - Urgau:stabilize-half_open_range_patterns, r=cjgillot

Stabilize `half_open_range_patterns`

This PR stabilize `feature(half_open_range_patterns)`:
```
Allows using `..=X` as a pattern.
```

And adds a new `feature(half_open_range_patterns_in_slices)` for the slice part, rust-lang/rust#102275 (comment).

The FCP was completed in rust-lang/rust#67264.,
Rename AssocItemKind::TyAlias to AssocItemKind::Type,
Rollup merge of #99696 - WaffleLapkin:uplift, r=fee1-dead

Uplift `clippy::for_loops_over_fallibles` lint into rustc

This PR, as the title suggests, uplifts [`clippy::for_loops_over_fallibles`] lint into rustc. This lint warns for code like this:
```rust
for _ in Some(1) {}
for _ in Ok::<_, ()>(1) {}
```
i.e. directly iterating over `Option` and `Result` using `for` loop.

There are a number of suggestions that this PR adds (on top of what clippy suggested):
1. If the argument (? is there a better name for that expression) of a `for` loop is a `.next()` call, then we can suggest removing it (or rather replacing with `.by_ref()` to allow iterator being used later)
   ```rust
    for _ in iter.next() {}
    // turns into
    for _ in iter.by_ref() {}
    ```
2. (otherwise) We can suggest using `while let`, this is useful for non-iterator, iterator-like things like [async] channels
   ```rust
   for _ in rx.recv() {}
   // turns into
   while let Some(_) = rx.recv() {}
   ```
3. If the argument type is `Result<impl IntoIterator, _>` and the body has a `Result<_, _>` type, we can suggest using `?`
   ```rust
   for _ in f() {}
   // turns into
   for _ in f()? {}
   ```
4. To preserve the original behavior and clear intent, we can suggest using `if let`
   ```rust
   for _ in f() {}
   // turns into
   if let Some(_) = f() {}
   ```
(P.S. `Some` and `Ok` are interchangeable depending on the type)

I still feel that the lint wording/look is somewhat off, so I'll be happy to hear suggestions (on how to improve suggestions :D)!

Resolves #99272

[`clippy::for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles,
Rollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8Ki

Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type`

Thanks `@camsteffen` for catching this in ast too, cc rust-lang/rust#102829 (comment),
merge rustc history,
Fix unclosed HTML tag in clippy doc,
fix `box-default` ignoring trait objects' types,
Fix allow_attributes_without_reason applying to external crate macros

Previously the `clippy::allow_attributes_without_reason` lint would
apply to external crate macros. Many macros in the Rust ecosystem
include these `allow` attributes without adding a reason, making this
lint pretty much unusable in any sizable Rust project.

This commit fixes that by adding a check to the lint if the attribute is
from an external crate macro and returning early.,
Fix bug in `referent_used_exactly_once`,
merge rustc history,
`default_numeric_fallback` do not lint on constants,
refactor `default_numeric_fallback`

We only need to store if the literal binding has an explicit type bound or not,
Book: Small grammar + link a11y change,
Remove CastCheckResult since it's unused,
add missing comma,
Auto merge of rust-lang#9644 - hkBst:patch-1, r=flip1995

add missing comma

changelog: none,
Auto merge of rust-lang#9643 - icecream17:patch-1, r=flip1995

Book: Small grammar + link a11y change

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: none

---

Very minor

For the link accessibility change, `here` and related don't provide context for screen readers who are reading a list of links.
(Random supporting google links)
https://www.w3.org/QA/Tips/noClickHere
https://usability.yale.edu/web-accessibility/articles/links,
Don't lint `ptr_arg` when used as an incompatible trait object,
Auto merge of rust-lang#9645 - Jarcho:ptr_arg_9542, r=llogiq

Don't lint `ptr_arg` when used as an incompatible trait object

fixes rust-lang#9542
changelog: [`ptr_arg`](https://rust-lang.github.io/rust-clippy/master/#ptr_arg): Don't lint when used as an incompatible trait object,
Add a suggestion and a note about orphan rules for `from_over_into`,
Auto merge of rust-lang#9649 - Alexendoo:from-over-into-suggestion, r=llogiq

Add a suggestion and a note about orphan rules for `from_over_into`

Adds a machine applicable suggestion to convert the `Into` impl into a `From` one to `from_over_into`

Also adds a note explaining that `impl From<Local> for Foreign` is fine if the `Into` type is foreign

Closes rust-lang#7444
Addresses half of rust-lang#9638

changelog: [`from_over_into`] Add a suggestion and a note about orphan rules,
Separate internal lints by pass,
Move some things around,
Expand `unnecessary_def_path` lint,
Fix adjacent code,
Format affected files,
`explicit_ty_bound` code golf,
[`zero_prefixed_literal`] Do not advise to use octal form if not possible,
Enable test no_std_main_recursion,
fix `box-default` linting `no_std` non-boxes,
Auto merge of rust-lang#9655 - llogiq:unbox-default, r=dswij

fix `box-default` linting `no_std` non-boxes

This fixes rust-lang#9653 by doing the check against the `Box` type correctly even if `Box` isn't there, as in `no_std` code. Thanks to `@lukas-code` for opening the issue and supplying a reproducer!

---

changelog: none,
Auto merge of rust-lang#9636 - kraktus:numeric-fallback, r=dswij

[`default_numeric_fallback`] do not lint on constants

fix rust-lang#9632

changelog:[`default_numeric_fallback`] do not lint on constants,
Auto merge of rust-lang#9566 - smoelius:diagnostic-item-path, r=dswij

Expand internal lint `unnecessary_def_path`

This PR does essentially two things:
* Separates the internal lints into modules by pass. (`internal_lints.rs` was over 1400 lines, which is a little unruly IMHO.)
* ~Adds a new~ Expands the `unnecessary_def_path` internal lint to flag hardcoded paths to diagnostic and language items.

My understanding is that the latter is currently done by reviewers. Automating this process should make things easier for both reviewers and contributors.

I could make the first bullet a separate PR, or remove it entirely, if desired.

changelog: Add internal lint `diagnostic_item_path`,
Add new lint `partial_pub_fields`

Signed-off-by: TennyZhuang <[email protected]>,
fix dogfood

Signed-off-by: TennyZhuang <[email protected]>,
add many tests

Signed-off-by: TennyZhuang <[email protected]>,
fix a doctest

Signed-off-by: TennyZhuang <[email protected]>,
Auto merge of rust-lang#9658 - TennyZhuang:partial-pub-fields, r=llogiq

Add new lint `partial_pub_fields`

Signed-off-by: TennyZhuang <[email protected]>

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: `partial_pub_fields`: new lint to disallow partial fields of a struct be pub

Resolve rust-lang#9604,
Auto merge of rust-lang#9652 - kraktus:octo_89, r=xFrednet

[`zero_prefixed_literal`] Do not advise to use octal form if not possible

fix rust-lang#9651

changelog: [`zero_prefixed_literal`] Do not advise to use octal form if not possible,
Auto merge of rust-lang#9609 - kraktus:hexa_f32, r=giraffate

[`unnecessary_cast`] Do not lint negative he

See merge request innersource/rust/toolset/rust-clippy!8
  • Loading branch information
wangkirin committed Feb 6, 2023
2 parents 5a84ad2 + 8a98609 commit b29ae3a
Show file tree
Hide file tree
Showing 1,432 changed files with 27,583 additions and 24,644 deletions.
7 changes: 7 additions & 0 deletions .github/driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ test "$sysroot" = $desired_sysroot
sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot)
test "$sysroot" = $desired_sysroot

# Check that the --sysroot argument is only passed once (SYSROOT is ignored)
(
cd rustc_tools_util
touch src/lib.rs
SYSROOT=/tmp RUSTFLAGS="--sysroot=$(rustc --print sysroot)" ../target/debug/cargo-clippy clippy --verbose
)

# Make sure this isn't set - clippy-driver should cope without it
unset CARGO_MANIFEST_DIR

Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ jobs:
with:
github_token: "${{ secrets.github_token }}"

- name: Install dependencies (Linux-i686)
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
if: matrix.host == 'i686-unknown-linux-gnu'

- name: Checkout
uses: actions/[email protected]

Expand Down Expand Up @@ -164,6 +157,11 @@ jobs:
- name: Test metadata collection
run: cargo collect-metadata

- name: Test lint_configuration.md is up-to-date
run: |
echo "run \`cargo collect-metadata\` if this fails"
git update-index --refresh
integration_build:
needs: changelog
runs-on: ubuntu-latest
Expand Down
538 changes: 535 additions & 3 deletions CHANGELOG.md

Large diffs are not rendered by default.

69 changes: 1 addition & 68 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,3 @@
# The Rust Code of Conduct

A version of this document [can be found online](https://www.rust-lang.org/conduct.html).

## Conduct

**Contact**: [[email protected]](mailto:[email protected])

* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience,
gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age,
religion, nationality, or other similar characteristic.
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and
welcoming environment for all.
* Please be kind and courteous. There's no need to be mean or rude.
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and
numerous costs. There is seldom a right answer.
* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and
see how it works.
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We
interpret the term "harassment" as including the definition in the <a href="http://citizencodeofconduct.org/">Citizen
Code of Conduct</a>; if you have any lack of clarity about what might be included in that concept, please read their
definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or
made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation
team][mod_team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a
safe place for you and we've got your back.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.

## Moderation


These are the policies for upholding our community's standards of conduct. If you feel that a thread needs moderation,
please contact the [Rust moderation team][mod_team].

1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks,
are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)
2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.
3. Moderators will first respond to such remarks with a warning.
4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off.
5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended
party a genuine apology.
7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a
different moderator, **in private**. Complaints about bans in-channel are not allowed.
8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate
situation, they should expect less leeway than others.

In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically
unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly
if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can
drive people away from the community entirely.

And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was
they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good
there was something you could've communicated better — remember that it's your responsibility to make your fellow
Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about
cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their
trust.

The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust,
#rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo);
GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org
(users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the
maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider
explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.

*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the
[Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*

[mod_team]: https://www.rust-lang.org/team.html#Moderation-team
The Code of Conduct for this repository [can be found online](https://www.rust-lang.org/conduct.html).
35 changes: 34 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ All contributors are expected to follow the [Rust Code of Conduct].
- [Issue and PR triage](#issue-and-pr-triage)
- [Bors and Homu](#bors-and-homu)
- [Contributions](#contributions)
- [License](#license)

[Zulip]: https://rust-lang.zulipchat.com/#narrow/stream/clippy
[Rust Code of Conduct]: https://www.rust-lang.org/policies/code-of-conduct

## The Clippy book

If you're new to Clippy and don't know where to start the [Clippy book] includes
If you're new to Clippy and don't know where to start, the [Clippy book] includes
a [developer guide] and is a good place to start your journey.

[Clippy book]: https://doc.rust-lang.org/nightly/clippy/index.html
Expand Down Expand Up @@ -245,6 +246,38 @@ Contributions to Clippy should be made in the form of GitHub pull requests. Each
be reviewed by a core contributor (someone with permission to land patches) and either landed in the
main tree or given feedback for changes that would be required.

All PRs should include a `changelog` entry with a short comment explaining the change. The rule of thumb is basically,
"what do you believe is important from an outsider's perspective?" Often, PRs are only related to a single property of a
lint, and then it's good to mention that one. Otherwise, it's better to include too much detail than too little.

Clippy's [changelog] is created from these comments. Every release, someone gets all commits from bors with a
`changelog: XYZ` entry and combines them into the changelog. This is a manual process.

Examples:
- New lint
```
changelog: new lint: [`missing_trait_methods`]
```
- False positive fix
```
changelog: Fix [`unused_peekable`] false positive when peeked in a closure or called as `f(&mut peekable)`
```
- Purely internal change
```
changelog: none
```

Note this it is fine for a PR to include multiple `changelog` entries, e.g.:
```
changelog: Something 1
changelog: Something 2
changelog: Something 3
```

[changelog]: CHANGELOG.md

## License

All code in this repository is under the [Apache-2.0] or the [MIT] license.

<!-- adapted from https://github.com/servo/servo/blob/master/CONTRIBUTING.md -->
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.66"
version = "0.1.69"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand All @@ -23,7 +23,7 @@ path = "src/driver.rs"
[dependencies]
clippy_lints = { path = "clippy_lints" }
semver = "1.0"
rustc_tools_util = "0.2.1"
rustc_tools_util = "0.3.0"
tempfile = { version = "3.2", optional = true }
termize = "0.1"

Expand All @@ -42,7 +42,7 @@ filetime = "0.2"
rustc-workspace-hack = "1.0"

# UI test dependencies
clap = { version = "3.1", features = ["derive"] }
clap = { version = "4.1.4", features = ["derive"] }
clippy_utils = { path = "clippy_utils" }
derive-new = "0.5"
if_chain = "1.0"
Expand All @@ -56,7 +56,7 @@ tokio = { version = "1", features = ["io-util"] }
rustc-semver = "1.1"

[build-dependencies]
rustc_tools_util = "0.2.1"
rustc_tools_util = "0.3.0"

[features]
deny-warnings = ["clippy_lints/deny-warnings"]
Expand Down
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Clippy

[![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test/badge.svg?branch=auto&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test%22+event%3Apush+branch%3Aauto)
[![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test%20(bors)/badge.svg?branch=auto&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test+(bors)%22+event%3Apush+branch%3Aauto)
[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](#license)

A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.

[There are over 550 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
[There are over 600 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.
Expand Down Expand Up @@ -194,21 +194,25 @@ value` mapping e.g.
```toml
avoid-breaking-exported-api = false
disallowed-names = ["toto", "tata", "titi"]
cognitive-complexity-threshold = 30
```

See the [list of lints](https://rust-lang.github.io/rust-clippy/master/index.html) for more information about which
lints can be configured and the meaning of the variables.
The [table of configurations](https://doc.rust-lang.org/nightly/clippy/lint_configuration.html)
contains all config values, their default, and a list of lints they affect.
Each [configurable lint](https://rust-lang.github.io/rust-clippy/master/index.html#Configuration)
, also contains information about these values.

> **Note**
>
> `clippy.toml` or `.clippy.toml` cannot be used to allow/deny lints.
For configurations that are a list type with default values such as
[disallowed-names](https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_names),
you can use the unique value `".."` to extend the default values instead of replacing them.

```toml
# default of disallowed-names is ["foo", "baz", "quux"]
disallowed-names = ["bar", ".."] # -> ["bar", "foo", "baz", "quux"]
```

> **Note**
>
> Configuration changes will not apply for code that has already been compiled and cached under `./target/`;
> for example, adding a new string to `doc-valid-idents` may still result in Clippy flagging that string. To be sure
> that any configuration changes are applied, you may want to run `cargo clean` and re-compile your crate from scratch.
> `clippy.toml` or `.clippy.toml` cannot be used to allow/deny lints.
To deactivate the “for further information visit *lint-link*” message you can
define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable.
Expand All @@ -230,7 +234,7 @@ in the `Cargo.toml` can be used.
rust-version = "1.30"
```

The MSRV can also be specified as an inner attribute, like below.
The MSRV can also be specified as an attribute, like below.

```rust
#![feature(custom_inner_attributes)]
Expand Down
4 changes: 2 additions & 2 deletions book/src/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Clippy

[![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test/badge.svg?branch=auto&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test%22+event%3Apush+branch%3Aauto)
[![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test%20(bors)/badge.svg?branch=auto&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test+(bors)%22+event%3Apush+branch%3Aauto)
[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](https://github.com/rust-lang/rust-clippy#license)

A collection of lints to catch common mistakes and improve your
[Rust](https://github.com/rust-lang/rust) code.

[There are over 550 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
[There are over 600 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
Expand Down
2 changes: 2 additions & 0 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [Installation](installation.md)
- [Usage](usage.md)
- [Configuration](configuration.md)
- [Lint Configuration](lint_configuration.md)
- [Clippy's Lints](lints.md)
- [Continuous Integration](continuous_integration/README.md)
- [GitHub Actions](continuous_integration/github_actions.md)
Expand All @@ -21,3 +22,4 @@
- [The Clippy Book](development/infrastructure/book.md)
- [Proposals](development/proposals/README.md)
- [Roadmap 2021](development/proposals/roadmap-2021.md)
- [Syntax Tree Patterns](development/proposals/syntax-tree-patterns.md)
18 changes: 14 additions & 4 deletions book/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@ basic `variable = value` mapping eg.
```toml
avoid-breaking-exported-api = false
disallowed-names = ["toto", "tata", "titi"]
cognitive-complexity-threshold = 30
```

See the [list of lints](https://rust-lang.github.io/rust-clippy/master/index.html) for more information about which
lints can be configured and the meaning of the variables.
The [table of configurations](./lint_configuration.md)
contains all config values, their default, and a list of lints they affect.
Each [configurable lint](https://rust-lang.github.io/rust-clippy/master/index.html#Configuration)
, also contains information about these values.

For configurations that are a list type with default values such as
[disallowed-names](https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_names),
you can use the unique value `".."` to extend the default values instead of replacing them.

```toml
# default of disallowed-names is ["foo", "baz", "quux"]
disallowed-names = ["bar", ".."] # -> ["bar", "foo", "baz", "quux"]
```

To deactivate the "for further information visit *lint-link*" message you can define the `CLIPPY_DISABLE_DOCS_LINKS`
environment variable.
Expand Down Expand Up @@ -72,7 +82,7 @@ minimum supported Rust version (MSRV) in the clippy configuration file.
msrv = "1.30.0"
```

The MSRV can also be specified as an inner attribute, like below.
The MSRV can also be specified as an attribute, like below.

```rust
#![feature(custom_inner_attributes)]
Expand Down
Loading

0 comments on commit b29ae3a

Please sign in to comment.