Commit graph

8217 commits

Author SHA1 Message Date
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
Matthias Krüger
6b1bad54ef rustup https://github.com/rust-lang/rust/pull/69644 2020-03-27 20:41:51 +01:00
Matthias Krüger
8177e49e10 rustup https://github.com/rust-lang/rust/pull/70344 2020-03-27 20:41:35 +01:00
flip1995
7a40b5c132
Move verbose_file_reads to restriction 2020-03-26 15:01:03 +01:00
flip1995
aa1ad42736
Also deploy from the beta branch 2020-03-25 20:20:54 +01:00
flip1995
d7440a0d7c
Document how to backport changes to beta 2020-03-25 19:52:58 +01:00
flip1995
14534fa071
Document how to create a Clippy release 2020-03-25 19:52:58 +01:00
bors
2ff568d746 Auto merge of #5334 - flip1995:backport_remerge, r=flip1995
Backport remerge

blocked on landing the backport

cc @ehuss

changelog: none
2020-03-25 18:07:35 +00:00
bors
5de8c101e5 Auto merge of #5372 - matthiaskrgr:rpc_nursery, r=flip1995
move redundant_pub_crate to nursery

cc #5369
changelog: none
2020-03-25 17:21:15 +00:00
Matthias Krüger
b86e8434df move redundant_pub_crate to nursery
cc #5369
2020-03-25 18:14:11 +01:00
bors
d3e21fe690 Auto merge of #5371 - matthiaskrgr:rdm, r=phansch
readme: explain how to run only a single lint on a codebase

changelog: none
2020-03-25 10:50:38 +00:00
Matthias Krüger
b0de238b65 readme: explain how to run only a single lint on a codebase 2020-03-25 11:37:07 +01:00
bors
513b46793e Auto merge of #5370 - phansch:matches, r=matthiaskrgr
Remove dependency on `matches` crate

The std equivalent works exactly the same.

changelog: none
2020-03-25 07:38:00 +00:00
Philipp Hansch
cec1e8f74e
Remove dependency on matches crate
The std equivalent works exactly the same.
2020-03-25 07:50:08 +01:00
bors
100a24d9d8 Auto merge of #5364 - flip1995:useless_transmute_quarantine, r=Manishearth
Move useless_transmute to nursery

cc #5343

@rust-lang/clippy anyone against moving this to nursery?

changelog: Move [`useless_transmute`] to nursery
2020-03-23 20:52:57 +00:00
bors
d3989eef2d Auto merge of #5319 - 1tgr:master, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them

changelog: Add `redundant_pub_crate` lint

Closes #5274.
2020-03-23 20:35:49 +00:00
mgr-inz-rafal
ff9602515e Code clean-up and formatting 2020-03-23 21:21:18 +01:00
mgr-inz-rafal
3d3af07845 Provide appropriate suggestion 2020-03-23 21:00:02 +01:00
flip1995
13fcee51e7
Move useless_transmute to nursery 2020-03-23 20:32:04 +01:00
mgr-inz-rafal
12796cd688 Initial lint without suggestion 2020-03-23 20:29:12 +01:00
Tim Robinson
870b9e8139 nursery group -> style 2020-03-23 16:45:31 +00:00
bors
1ff81c1b6d Auto merge of #5350 - ThibsG:FixSingleBindingClosure, r=flip1995
Fix single binding closure

Fix the `match_single_binding` lint when triggered inside a closure.

Fixes: #5347

changelog: Improve suggestion for [`match_single_binding`]
2020-03-23 15:17:09 +00:00
bors
43bdee034f Auto merge of #5361 - matthiaskrgr:rustup_37, r=flip1995
rustup https://github.com/rust-lang/rust/pull/69968/

changelog: none
2020-03-23 14:41:57 +00:00
Matthias Krüger
0f319513d2 rustup https://github.com/rust-lang/rust/pull/69968/ 2020-03-23 15:21:46 +01:00
bors
89303daf6c Auto merge of #5353 - flip1995:conf_doc, r=Manishearth
Fix documentation generation for configurable lints

In #5135, the configuration macro changed, but the documentation generation script wasn't updated. This PR catches up on this.

[Preview](https://flip1995.github.io/rust-clippy/master/index.html)

r? @Manishearth

changelog: Document configuration options of lints again.
2020-03-22 18:54:58 +00:00
flip1995
a1dc609f21
Fix documentation generation for configurable lints 2020-03-22 18:15:06 +01:00
ThibsG
badfbbbbde Fix single binding in closure 2020-03-22 10:31:30 +01:00