Commit graph

8093 commits

Author SHA1 Message Date
bors
a840d594cc Auto merge of #5349 - jpospychala:useless_rc, r=Manishearth
useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T>

refers to  #2394

changelog: Add lints for Rc<Rc<T>> and Rc<Box<T>> and Rc<&T>, Box<&T>

this is based on top of another change #5310 so probably should go after that one.
2020-04-02 03:11:29 +00:00
Jacek Pospychala
f8e892db5e useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T> 2020-04-02 00:02:25 +02:00
bors
7ebb3aa55d Auto merge of #5402 - pmk21:allow-let-underscore-must-use, r=flip1995
Allow let_underscore_must_use to be ignored

changelog: none
Fixes #5366
2020-04-01 21:43:44 +00:00
bors
42796e11c5 Auto merge of #5401 - dtolnay:option, r=Manishearth
Downgrade option_option to pedantic

Based on a search of my work codebase (\>500k lines) for `Option<Option<`, it looks like a bunch of reasonable uses to me. The documented motivation for this lint is:

> an optional optional value is logically the same thing as an optional value but has an unneeded extra level of wrapping

which seems a bit bogus in practice. For example a typical usage would look like:

```rust
let mut host: Option<String> = None;
let mut port: Option<i32> = None;
let mut payload: Option<Option<String>> = None;

for each field {
    match field.name {
        "host" => host = Some(...),
        "port" => port = Some(...),
        "payload" => payload = Some(...), // can be null or string
        _ => return error,
    }
}

let host = host.ok_or(...)?;
let port = port.ok_or(...)?;
let payload = payload.ok_or(...)?;
do_thing(host, port, payload)
```

This lint seems to fit right in with the pedantic group; I don't think linting on occurrences of `Option<Option<T>>` by default is justified.

---

changelog: Remove option_option from default set of enabled lints
2020-04-01 21:30:24 +00:00
pmk21
c9978b69bd Allow let_underscore 2020-04-02 00:48:16 +05:30
David Tolnay
f6e8da81f1
Update option_option ui test 2020-04-01 12:15:39 -07:00
pmk21
97acabe56a Test for ignoring let_underscore_must_use 2020-04-02 00:44:09 +05:30
David Tolnay
86b0dd4197
Downgrade option_option to pedantic 2020-04-01 12:00:49 -07:00
bors
326b22048a Auto merge of #5400 - flip1995:rustup, r=Manishearth
Rustups

r? @Manishearth

changelog: none
2020-04-01 18:51:38 +00:00
flip1995
fcc56fcd1b
Fix dogfood fallout 2020-04-01 20:24:46 +02:00
flip1995
7d58ba20b4
Rustup to rust-lang/rust#70632 2020-04-01 20:14:05 +02:00
flip1995
63987aafba
Rustup to rust-lang/rust#70081 2020-04-01 20:12:36 +02:00
flip1995
3142ee3f7a
Rustup to rust-lang/rust#70627 2020-04-01 19:42:15 +02:00
bors
c211cea3e9 Auto merge of #5398 - flip1995:deescalate, r=Manishearth
Stop updating the lint counter with every new lint

r? @Manishearth

This PR does two things:

1. Clean up the clippy_dev module a bit (first 3 commits; cc #5394 )
2. Make the counter in the README count in steps of 50 lints. Also use a `lazy_static` `Vec` for the lint list, so no counter is required there anymore.

changelog: none
2020-03-31 15:36:54 +00:00
flip1995
cbdf4cc71e
Run update_lints 2020-03-31 17:24:09 +02:00
flip1995
3155eedb68
Don't use an exact lint counter anymore 2020-03-31 17:24:09 +02:00
flip1995
5de019074b
Move update_lints logic to its own module 2020-03-31 17:24:09 +02:00
flip1995
deb1979b8e
Make limit_stderr_length a subcommand 2020-03-31 17:24:09 +02:00
flip1995
8b9d70d349
Define modules in lib.rs instead of main.rs 2020-03-31 17:24:09 +02:00
bors
09fe163c92 Auto merge of #5397 - pmk21:macro-single-match, r=flip1995
Avoid single_match lint in macro rules

changelog: none
fixes #5359
2020-03-31 11:45:43 +00:00
pmk21
79ab05458f Small formatting change 2020-03-31 16:13:51 +05:30
pmk21
4cac9786c5 Skip single_match lints in macro rules 2020-03-31 15:50:15 +05:30
pmk21
793403a2a8 Added test for single_match_else in macro 2020-03-31 15:49:49 +05:30
pmk21
ba6a3280f5 Added test for single_match in macro 2020-03-31 15:49:27 +05:30
bors
1cac2f9e86 Auto merge of #5293 - matthiaskrgr:macro_skip_lifetime, r=phansch
don't emit lifetime lint warnings for code inside macros.

Fixes #5283

changelog: Don't emit lifetime lint warnings for code inside macros.
2020-03-30 21:33:49 +00:00
Matthias Krüger
8e83afa61f don't emit lifetime lints for code inside macros.
Fixes #5283
2020-03-30 23:22:50 +02:00
bors
0a25944f78 Auto merge of #5294 - tmiasko:trait-ptr-cmp, r=Manishearth
Lint unnamed address comparisons

Functions and vtables have an insignificant address. Attempts to compare such addresses will lead to very surprising behaviour. For example: addresses of different functions could compare equal; two trait object pointers representing the same object and the same type could be unequal.

Lint against unnamed address comparisons to avoid issues like those in rust-lang/rust#69757 and rust-lang/rust#54685.

changelog: New lints: [`fn_address_comparisons`] [#5294](https://github.com/rust-lang/rust-clippy/pull/5294), [`vtable_address_comparisons`] [#5294](https://github.com/rust-lang/rust-clippy/pull/5294)
2020-03-30 19:52:41 +00:00
Tomasz Miąsko
b77b219280 Lint unnamed address comparisons 2020-03-30 21:42:16 +02:00
bors
42c36dc77b Auto merge of #5365 - mgr-inz-rafal:issue4983_bool_updates, r=yaahc
Issue4983 bool updates

changelog: Check for bool inequality comparison that might be written more concisely

Fixes #4983
2020-03-30 19:20:10 +00:00
Jane Lusby
c8f3241177
Update clippy_lints/src/needless_bool.rs 2020-03-30 12:19:30 -07:00
bors
3e1dd20230 Auto merge of #5373 - flip1995:doc_release_backport, r=Manishearth
Document how to create releases and backports

This PR adds documentation on how to create Clippy releases and backports.

This PR also introduces a new backport/release process for Clippy:

- A beta branch is introduced: https://github.com/rust-lang/rust-clippy/tree/beta
- Backports are now done by PRs to the `beta` branch
- also commits to the beta branch will be deployed, so that the documentation page has a tab for the Clippy beta release.

This has two advantages:

1. The Clippy release process is closer to the Rust release process: stable releases are tagged, the beta release has its own branch
2. Backports to beta are easier, since they don't need as much coordination as before. No new branch has to be created for a backport. Just a PR to the beta branch, like in the Rust repo.¹

I tested the deployment here: https://github.com/flip1995/rust-clippy/runs/534465081 and it created this commit: 734503377e, so it works.

r? @Manishearth your thoughts?

[Rendered (release.md)](https://github.com/flip1995/rust-clippy/blob/doc_release_backport/doc/release.md)
[Rendered (backport.md)](https://github.com/flip1995/rust-clippy/blob/doc_release_backport/doc/backport.md)

changelog: none

---

¹: For this, we may have to modify the CI, so that beta rustc is used to check PRs to beta (or we test it locally, and merge it without bors)
2020-03-30 18:53:05 +00:00
bors
563da5248d Auto merge of #5387 - jpospychala:useless_self_fp, r=yaahc
`unused_self` false positive

fixes #5351

Remove the for loop in `unused_self` so that lint enabled for one method doesn't trigger on another method.

changelog: Fix false positive in `unused_self` around lint gates on impl items
2020-03-30 18:10:21 +00:00
Philipp Krones
2a4493aaa6
Fix typo in release.md
Co-Authored-By: Phil Hansch <dev@phansch.net>
2020-03-30 19:32:48 +02:00
bors
e170c84942 Auto merge of #5392 - matthiaskrgr:rustup_40, r=phansch
rustup  https://github.com/rust-lang/rust/pull/70536

changelog: none
2020-03-30 13:22:34 +00:00
Matthias Krüger
aff57e0f43 rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
bors
bfd11235a6 Auto merge of #5380 - lzutao:deprecate-REPLACE_CONSTS, r=phansch
Deprecate REPLACE_CONSTS lint

Closes #5346
changelog: Deprecate `replace_consts` lint
2020-03-30 08:03:42 +00:00
bors
0254c421f9 Auto merge of #5390 - phansch:rustupp, r=matthiaskrgr
Rustup to https://github.com/rust-lang/rust/pull/70449

cc https://github.com/rust-lang/rust/pull/70449

changelog: none
2020-03-30 07:31:25 +00:00
Philipp Hansch
68ed6ccf04
Rustup to https://github.com/rust-lang/rust/pull/70449 2020-03-30 07:34:19 +02:00
Jacek Pospychala
82f929cbaf unused_self false positive 2020-03-29 22:22:36 +02:00
bors
d3c40a1519 Auto merge of #5382 - richkadel:gitattributes-macro, r=phansch
git attribute macros not allowed in submodules

This change simply moves the `rust` macro definition directly into the
attributes for `*.rs` files.

git commands that recurse from the rust toplevel tree into submodules
produce errors in clippy due to the fact that:

  "Custom macro attributes can be defined only in top-level
  gitattributes files"

For example, from the toplevel `rust` directory in a rustc development
build, try:

  $ git grep "search string" --recurse-submodules

Embedded within the actual results is the error message:

  [attr]rust text eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4
   not allowed: src/tools/clippy/.gitattributes:1

Thank you for making Clippy better!

We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.

If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [ ] Executed `cargo dev update_lints`
- [ ] Added lint documentation
- [ ] Run `cargo dev fmt`

[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.

Delete this line and everything above before opening your PR.

---

changelog: none
2020-03-29 18:14:38 +00:00
bors
6527c3d99c Auto merge of #5384 - matthiaskrgr:readme_4, r=matthiaskrgr
readme: move "how to run single lint" instructions to "Allowing/denying lints" section.

changelog: none
2020-03-29 15:28:56 +00:00
Matthias Krüger
8fbf02c8fb readme: move "how to run single lint" instructions to "Allowing/denying lints" section. 2020-03-29 17:01:56 +02:00
Rich Kadel
b4736b4d35 git attribute macros not allowed in submodules
This change simply moves the `rust` macro definition directly into the
attributes for `*.rs` files.

git commands that recurse from the rust toplevel tree into submodules
produce errors in clippy due to the fact that:

  "Custom macro attributes can be defined only in top-level
  gitattributes files"

For example, from the toplevel `rust` directory in a rustc development
build, try:

  $ git grep "search string" --recurse-submodules

Embedded within the actual results is the error message:

  [attr]rust text eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4
   not allowed: src/tools/clippy/.gitattributes:1
2020-03-29 06:58:37 -07:00
bors
ec5e9c7bbd Auto merge of #5381 - lzutao:itertools, r=matthiaskrgr
Bump itertools

changelog: none
2020-03-29 13:19:32 +00:00
Lzu Tao
d055b7d61c Deprecate REPLACE_CONSTS lint 2020-03-29 12:59:35 +07:00
Lzu Tao
53880a5bd6 Bump itertools 2020-03-29 12:50:11 +07:00
bors
70b93aab6e Auto merge of #5376 - flip1995:verbose_file_reads_restriction, r=matthiaskrgr
Move verbose_file_reads to restriction

cc #5368

Using `File::read` instead of  `fs::read_to_end` does make sense in multiple cases, so this lint is rather restriction, than complexity

changelog: Move [`verbose_file_reads`] to restriction
2020-03-27 20:13:06 +00:00
bors
64befe59cc Auto merge of #5377 - matthiaskrgr:rustup_38, r=flip1995
rustup

changelog: none
2020-03-27 19:57:44 +00:00
Matthias Krüger
0982097e4d remove redundant import 2020-03-27 20:47:34 +01:00
Matthias Krüger
48da6e926c rustup https://github.com/rust-lang/rust/pull/68404 2020-03-27 20:41:53 +01:00