Skip to content

Update Clippy #80623

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 53 commits into from
Jan 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
a451b2a
Added from_over_into lint
1c3t3a Dec 19, 2020
dd005c1
Added MSRV and fixed typo
1c3t3a Dec 20, 2020
97f5db9
Website issue tracker link and better search performance
xFrednet Dec 20, 2020
f03edfd
Merge commit '4911ab124c481430672a3833b37075e6435ec34d' into clippyup
flip1995 Dec 20, 2020
7e641c8
Fixed error messages
1c3t3a Dec 20, 2020
0d6c128
Update clippy_lints/src/from_over_into.rs
llogiq Dec 21, 2020
12bd244
Don't trigger large_enum_variant in external macros
phansch Dec 21, 2020
19ace28
readme: remove paragraph about installing clippy manually on ci, if i…
matthiaskrgr Dec 21, 2020
400d40b
Auto merge of #6488 - matthiaskrgr:readme_clp, r=flip1995
bors Dec 21, 2020
53f4d43
Update from_over_into.stderr
1c3t3a Dec 21, 2020
51947df
Auto merge of #6485 - phansch:macro-check-large-enum-variant, r=llogiq
bors Dec 21, 2020
04d3044
readme: remove paragraph about executing clippy via "cargo run .."
matthiaskrgr Dec 22, 2020
d6a7ebc
ci: test cargo clippy --fix -Zunstable-options
matthiaskrgr Dec 22, 2020
af22613
remove clone in manual_async_fn lint
matthiaskrgr Dec 22, 2020
4b233c8
Auto merge of #6497 - matthiaskrgr:clone_1, r=flip1995
bors Dec 22, 2020
25e9acb
Auto merge of #6476 - 1c3t3a:1c3t3a-from-over-into, r=llogiq
bors Dec 22, 2020
1f9e4cb
Auto merge of #6494 - matthiaskrgr:readme_, r=flip1995
bors Dec 22, 2020
8bdf34e
Fix default initialized fields in suggestion
camsteffen Nov 23, 2020
73ce34a
Remove redundant shadow check
camsteffen Nov 23, 2020
c6450c7
Fix field_reassign_with_default for private fields
camsteffen Nov 23, 2020
7fa1d78
Revert "Pass Clippy args also trough RUSTFLAGS"
flip1995 Dec 22, 2020
f055e7f
Fixed a value spelling mistake
xFrednet Dec 22, 2020
4772eb8
Auto merge of #6498 - rust-lang:revert-6441-use_rustflags, r=ebroto
bors Dec 22, 2020
971e5b3
Auto merge of #6496 - matthiaskrgr:test_fix, r=Manishearth
bors Dec 22, 2020
5c98135
Auto merge of #6483 - xFrednet:5386-github-ticket-search, r=killercup
bors Dec 23, 2020
88491e2
Special sync of 'e89801553ddbaccdeb2eac4db08900edb51ac7ff'
flip1995 Dec 23, 2020
3687de2
ISSUE_TEMPLATE: add templates for false negative and false positive t…
matthiaskrgr Dec 22, 2020
2218dd6
ci: run cargo clippy --fix -Zunstable-options in the correct directory.
matthiaskrgr Dec 24, 2020
02399f4
Auto merge of #6504 - matthiaskrgr:cifix, r=matthiaskrgr
bors Dec 24, 2020
e1743ef
Fix a style of texts in `map_err_ignore`
giraffate Dec 24, 2020
dfaea9c
lint &PathBuf instead of &Path in PTR_ARG
alex-700 Dec 25, 2020
b1e0d15
Auto merge of #6505 - giraffate:fix_style_of_texts_in_map_err_ignore,…
bors Dec 25, 2020
0154965
Auto merge of #6495 - matthiaskrgr:FN_FP_issue_templates, r=flip1995
bors Dec 27, 2020
3661848
Auto merge of #6375 - camsteffen:reassign-default-private, r=flip1995
bors Dec 27, 2020
61a3ee7
Auto merge of #6506 - alex-700:add-path-buf-to-ptr-arg-lint, r=Manish…
bors Dec 27, 2020
203715a
don't ignore expression after first not matched method call in PtrClo…
alex-700 Dec 27, 2020
0d8a27a
Auto merge of #6510 - alex-700:fix-ptr-arg-lint, r=llogiq
bors Dec 28, 2020
6fd18f9
Remove unnecessary semicolon from Clippy test
Aaron1011 Dec 29, 2020
5479bba
Rename kw::Invalid -> kw::Empty
jyn514 Dec 30, 2020
7f44f1d
Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkov
m-ou-se Dec 30, 2020
59397d6
make clippy version number correspond to rustc version number.
matthiaskrgr Dec 31, 2020
60919e4
Auto merge of #6526 - matthiaskrgr:version, r=Manishearth
bors Jan 1, 2021
48dec84
first pass at default values for const generics
JulianKnodt Dec 31, 2020
e5a1f22
Initial support for Rust 2021.
m-ou-se Jan 1, 2021
b196528
Auto merge of #6530 - m-ou-se:2021, r=phansch
bors Jan 2, 2021
d93692e
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jan 2, 2021
db268f8
Bump nightly version to 2021-01-02
flip1995 Jan 2, 2021
106ca96
Use rustc --version in versioncheck
flip1995 Jan 2, 2021
e4fbc5f
Bump Clippy version to 0.1.51
flip1995 Jan 2, 2021
1fcc74c
Auto merge of #6536 - flip1995:rustup, r=flip1995
bors Jan 2, 2021
100c793
Merge commit '1fcc74cc9e03bc91eaa80ecf92976b0b14b3aeb6' into clippyup
flip1995 Jan 2, 2021
d35d827
Update Cargo.lock
flip1995 Jan 2, 2021
5dd64b3
Use bootstrap rustc for versioncheck in Clippy
flip1995 Jan 2, 2021
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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ dependencies = [

[[package]]
name = "clippy"
version = "0.0.212"
version = "0.1.51"
dependencies = [
"cargo_metadata 0.12.0",
"clippy-mini-macro-test",
Expand All @@ -589,7 +589,7 @@ version = "0.2.0"

[[package]]
name = "clippy_lints"
version = "0.0.212"
version = "0.1.51"
dependencies = [
"cargo_metadata 0.12.0",
"if_chain",
Expand Down
35 changes: 35 additions & 0 deletions src/tools/clippy/.github/ISSUE_TEMPLATE/false_negative.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug Report (False Negative)
about: Create a bug report about missing warnings from a lint
labels: L-bug, L-false-negative
---
<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->
Lint name:


I tried this code:

```rust
<code>
```

I expected to see this happen: *explanation*

Instead, this happened: *explanation*

### Meta

- `cargo clippy -V`: e.g. clippy 0.0.212 (f455e46 2020-06-20)
- `rustc -Vv`:
```
rustc 1.46.0-nightly (f455e46ea 2020-06-20)
binary: rustc
commit-hash: f455e46eae1a227d735091091144601b467e1565
commit-date: 2020-06-20
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0
```
35 changes: 35 additions & 0 deletions src/tools/clippy/.github/ISSUE_TEMPLATE/false_positive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug Report (False Positive)
about: Create a bug report about a wrongly emitted lint warning
labels: L-bug, L-false-positive
---
<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->
Lint name:


I tried this code:

```rust
<code>
```

I expected to see this happen: *explanation*

Instead, this happened: *explanation*

### Meta

- `cargo clippy -V`: e.g. clippy 0.0.212 (f455e46 2020-06-20)
- `rustc -Vv`:
```
rustc 1.46.0-nightly (f455e46ea 2020-06-20)
binary: rustc
commit-hash: f455e46eae1a227d735091091144601b467e1565
commit-date: 2020-06-20
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0
```
3 changes: 3 additions & 0 deletions src/tools/clippy/.github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
- name: Build
run: cargo build --features deny-warnings,internal-lints

- name: Test "--fix -Zunstable-options"
run: cargo run --features deny-warnings,internal-lints --bin cargo-clippy -- clippy --fix -Zunstable-options

- name: Test
run: cargo test --features deny-warnings,internal-lints

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1841,6 +1841,7 @@ Released 2018-09-13
[`forget_copy`]: https://rust-lang.github.io/rust-clippy/master/index.html#forget_copy
[`forget_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#forget_ref
[`from_iter_instead_of_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#from_iter_instead_of_collect
[`from_over_into`]: https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
[`future_not_send`]: https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
[`get_last_with_len`]: https://rust-lang.github.io/rust-clippy/master/index.html#get_last_with_len
[`get_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#get_unwrap
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.0.212"
version = "0.1.51"
authors = [
"Manish Goregaokar <[email protected]>",
"Andre Bogus <[email protected]>",
Expand Down Expand Up @@ -29,7 +29,7 @@ path = "src/driver.rs"

[dependencies]
# begin automatic update
clippy_lints = { version = "0.0.212", path = "clippy_lints" }
clippy_lints = { version = "0.1.50", path = "clippy_lints" }
# end automatic update
semver = "0.11"
rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util" }
Expand Down
43 changes: 10 additions & 33 deletions src/tools/clippy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ A collection of lints to catch common mistakes and improve your [Rust](https://g
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.

Category | Description | Default level
-- | -- | --
`clippy::all` | all lints that are on by default (correctness, style, complexity, perf) | **warn/deny**
`clippy::correctness` | code that is outright wrong or very useless | **deny**
`clippy::style` | code that should be written in a more idiomatic way | **warn**
`clippy::complexity` | code that does something simple but in a complex way | **warn**
`clippy::perf` | code that can be written to run faster | **warn**
`clippy::pedantic` | lints which are rather strict or might have false positives | allow
`clippy::nursery` | new lints that are still under development | allow
`clippy::cargo` | lints for the cargo manifest | allow
| Category | Description | Default level |
| --------------------- | ----------------------------------------------------------------------- | ------------- |
| `clippy::all` | all lints that are on by default (correctness, style, complexity, perf) | **warn/deny** |
| `clippy::correctness` | code that is outright wrong or very useless | **deny** |
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
| `clippy::complexity` | code that does something simple but in a complex way | **warn** |
| `clippy::perf` | code that can be written to run faster | **warn** |
| `clippy::pedantic` | lints which are rather strict or might have false positives | allow |
| `clippy::nursery` | new lints that are still under development | allow |
| `clippy::cargo` | lints for the cargo manifest | allow |

More to come, please [file an issue](https://github.com/rust-lang/rust-clippy/issues) if you have ideas!

Expand Down Expand Up @@ -98,17 +98,6 @@ If you want to run Clippy **only** on the given crate, use the `--no-deps` optio
cargo clippy -p example -- --no-deps
```

### Running Clippy from the command line without installing it

To have cargo compile your crate with Clippy without Clippy installation
in your code, you can use:

```terminal
cargo run --bin cargo-clippy --manifest-path=path_to_clippys_Cargo.toml
```

*Note:* Be sure that Clippy was compiled with the same version of rustc that cargo invokes here!

### Travis CI

You can add Clippy to Travis CI in the same way you use it locally:
Expand All @@ -130,18 +119,6 @@ script:
# etc.
```

If you are on nightly, It might happen that Clippy is not available for a certain nightly release.
In this case you can try to conditionally install Clippy from the Git repo.

```yaml
language: rust
rust:
- nightly
before_script:
- rustup component add clippy --toolchain=nightly || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
# etc.
```

Note that adding `-D warnings` will cause your build to fail if **any** warnings are found in your code.
That includes warnings found by rustc (e.g. `dead_code`, etc.). If you want to avoid this and only cause
an error for Clippy warnings, use `#![deny(clippy::all)]` in your code or `-D clippy::all` on the command
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_dev/src/ra_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::fs;
use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;
use std::path::{Path, PathBuf};

// This module takes an absolute path to a rustc repo and alters the dependencies to point towards
// the respective rustc subcrates instead of using extern crate xyz.
Expand Down Expand Up @@ -44,7 +44,7 @@ pub fn run(rustc_path: Option<&str>) {
}

fn inject_deps_into_manifest(
rustc_source_dir: &PathBuf,
rustc_source_dir: &Path,
manifest_path: &str,
cargo_toml: &str,
lib_rs: &str,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "clippy_lints"
# begin automatic update
version = "0.0.212"
version = "0.1.51"
# end automatic update
authors = [
"Manish Goregaokar <[email protected]>",
Expand Down
Loading