Commit graph

13272 commits

Author SHA1 Message Date
bors
2e3b64deef Auto merge of #89861 - nbdd0121:closure, r=wesleywiser
Closure capture cleanup & refactor

Follow up of #89648

Each commit is self-contained and the rationale/changes are documented in the commit message, so it's advisable to review commit by commit.

The code is significantly cleaner (at least IMO), but that could have some perf implication, so I'd suggest a perf run.

r? `@wesleywiser`
cc `@arora-aman`
2022-01-13 18:51:07 +00:00
SeeSpring
875b240083 Apply not_unsafe_ptr_arg_deref to type aliases 2022-01-13 09:47:56 -05:00
flip1995
7e267c23d6 Fix Clippy sync fallout 2022-01-13 13:37:29 +01:00
flip1995
fb0142ae41 Merge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyup 2022-01-13 13:18:19 +01:00
bors
97a5daa659 Auto merge of #8272 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2022-01-13 11:55:36 +00:00
flip1995
6ad05bcbbe
Bump nightly version -> 2022-01-13 2022-01-13 12:48:17 +01:00
flip1995
8a2141bae4
Bump Clippy Version -> 0.1.60 2022-01-13 12:48:08 +01:00
flip1995
11be495bde
Merge remote-tracking branch 'upstream/master' into rustup 2022-01-13 12:47:48 +01:00
Jason Newcomb
7ed86bf822 Changes to ptr_arg
* Track the argument when used to initialize simple `let` bindings
* Check if the argument is passed to a function requiring the original type
* Use `multipart_suggestion` rather than multiple suggestions
* Check if the name given in the source code matches the name of the actual type
2022-01-12 20:57:50 -05:00
bors
60e68d68c6 Auto merge of #8226 - Jarcho:manual_memcpy_8160, r=flip1995
`manual_memcpy` fix

fixes #8160

Ideally this would work with `VecDeque`, but the current interface is unsuitable for it. At a minimum something like `range_as_slices` would be needed.

changelog: Don't lint `manual_memcpy` on `VecDeque`
changelog: Suggest `copy_from_slice` for `manual_memcpy` when applicable
2022-01-12 18:44:34 +00:00
Jason Newcomb
ad95279c34 Suggest deref when needed in implicit_clone 2022-01-12 13:03:38 -05:00
Tomasz Miąsko
d389cfccb5 Remove LLVM-style inline assembly from clippy 2022-01-12 18:51:32 +01:00
Jason Newcomb
062db10c12 Add manual_memcpy_test for VecDeque 2022-01-12 12:33:47 -05:00
bors
5479024250 Auto merge of #8266 - camsteffen:test-tweaks, r=flip1995
Some test code cleanup

changelog: none

Mainly moves /clippy_workspace_tests into /tests and combines the two dogfood tests which can't run concurrently.
2022-01-12 17:19:58 +00:00
bors
133b3668bb Auto merge of #8265 - camsteffen:which-rustfmt, r=xFrednet
Cache rustfmt path

changelog: none

Call `rustup which rustfmt` and use the output. This shaves off  ~0.7 seconds for `cargo dev fmt` for me.
2022-01-12 17:03:52 +00:00
Cameron Steffen
90bf72c2cd Only run dogfood on linux in CI 2022-01-12 11:00:26 -06:00
bors
6f33f690ea Auto merge of #8112 - Alexendoo:disallowed_methods_primitives, r=flip1995
Allow primitive types in disallowed_methods

Fixes #8079

changelog: `disallowed_methods`: Now can disallow methods of primitive types
2022-01-12 16:47:45 +00:00
Alex Macleod
04eb27aeaf Use method name from conf::DisallowedMethod
Since def_path_str returns e.g. "core::f32::<impl f32>::clamp" for
"f32::clamp"
2022-01-12 16:23:22 +00:00
bors
7c82ae1c12 Auto merge of #8213 - paolobarbolini:size-of-as-bits, r=flip1995
Add `manual_bits` lint

Closes #6670

---

changelog: new lint: [`manual_bits`]
2022-01-12 16:21:14 +00:00
Alex Macleod
91581f6d5e Resolve primitive impls in clippy_utils::path_to_res 2022-01-12 16:20:23 +00:00
Paolo Barbolini
166737f3cb Add manual_bits lint 2022-01-12 16:46:57 +01:00
bors
b9cae79d7f Auto merge of #8037 - ojeda:doc-codegen-change, r=camsteffen
`README`: document that Clippy may change codegen

Currently, Clippy does not guarantee the same codegen will be produced.
Therefore, it should not be used as an universal replacement for `rustc`.

See https://github.com/rust-lang/rust-clippy/issues/8035.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

fixes #8035
changelog: document that Clippy may change codegen
2022-01-12 15:11:08 +00:00
bors
ae01c4ab3c Auto merge of #8190 - camsteffen:no-in-band-liftetimes, r=flip1995
Stop using `in_band_lifetimes`

Per rust-lang/rust#91867

changelog: none
2022-01-12 14:25:11 +00:00
bors
0d94167a23 Auto merge of #8198 - camsteffen:no-method-call-macro, r=flip1995
Remove method_call! macro

This is possible now that `SymbolStr` is removed from rustc.

changelog: none
2022-01-12 13:59:12 +00:00
bors
37e9985e86 Auto merge of #8268 - Jarcho:deref_addrof_8247, r=flip1995
Fix `deref_addrof`

fixes #8247

This would supersede #8259

changelog: Don't lint `deref_addrof` when the dereference and the borrow occur in different contexts
2022-01-12 13:25:58 +00:00
Jason Newcomb
d32277d78e Don't lint deref_addrof when the two operations occur in different expansions 2022-01-12 00:25:42 -05:00
bors
88f5be2041 Auto merge of #8262 - 1nF0rmed:chore-update-borrowed-box-doc, r=camsteffen
Improve documentation for `borrowed-box` lint

fixes #8161

Updates documentation to elaborate more on how removing Box from a function parameter can generalize the function.

changelog: none
2022-01-11 17:07:50 +00:00
Pradyumna Rahul
7e989ec07a Improve documentation for borrowed-box lint 2022-01-11 22:02:15 +05:30
Cameron Steffen
02ec39b2ff Stop using in_band_lifetimes 2022-01-11 09:52:23 -06:00
bors
fd9cebe6eb Auto merge of #8210 - guerinoni:master, r=Manishearth
Add borrow_as_ptr lint

Closes: #6995

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

---

changelog: new lint: [`borrow_as_ptr`]
2022-01-11 15:45:50 +00:00
Aaron Hill
dda2aef64f Store a Symbol instead of an Ident in VariantDef/FieldDef
The field is also renamed from `ident` to `name. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.

This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.
2022-01-11 10:16:22 -05:00
Miguel Ojeda
3d4fdedd7e README: mention clippy-driver on usage list
Removes the "compiled from source" bit, which is confusing.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-01-11 14:48:25 +01:00
Miguel Ojeda
fd97d792f9 README: clippy-driver is not a replacement for rustc
Currently, `clippy-driver` may run codegen, but this is an
implementation detail.

See https://github.com/rust-lang/rust-clippy/issues/8035.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-01-11 14:48:25 +01:00
Federico Guerinoni
3298de7f66 Add borrow_as_ptr lint
Closes: #6995

Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
Co-authored-by: Paolo Barbolini <paolo@paolo565.org>
2022-01-11 09:53:29 +01:00
bors
fccf07bae5 Auto merge of #8260 - taiki-e:mutex_atomic, r=llogiq
Downgrade mutex_atomic to nursery

See #1516 and #4295.

There are suggestions about removing this lint from the default warned lints in both issues.
Also, [`mutex_integer`](https://rust-lang.github.io/rust-clippy/master/index.html#mutex_integer) lint that has the same problems as this lint is in `nursery` group.

changelog: Moved [`mutex_atomic`] to `nursery`
2022-01-11 08:09:11 +00:00
Cameron Steffen
01ef7c7932 Fix dogfood 2022-01-10 18:00:47 -06:00
bors
51282fc488 Auto merge of #8261 - taiki-e:disallowed, r=giraffate
Warn disallowed_methods and disallowed_types by default

Closes #7841

changelog: Moved [`disallowed_methods`] and [`disallowed_types`] to `style`
2022-01-10 23:51:39 +00:00
Cameron Steffen
21343ab2a5 Remove rustfmt component check
This was more valuable when we used the latest nightly without
specifying the toolchain version.
2022-01-10 17:08:22 -06:00
Cameron Steffen
4a54933845 Merge dogfood tests
The two dogfood tests cannot be run concurrently since they use the same
target directory.
2022-01-10 17:08:22 -06:00
Cameron Steffen
920e9f0c4b Move workspace test 2022-01-10 17:08:22 -06:00
Cameron Steffen
d356fb9fa2 Use rustup which rustfmt 2022-01-10 17:04:38 -06:00
Cameron Steffen
51dbbf3c4c Refactor test utils 2022-01-10 15:22:17 -06:00
Cameron Steffen
7cf4f44e56 Fix output capturing 2022-01-10 15:11:25 -06:00
Cameron Steffen
e66ecf6f0e Run dogfood on windows
I believe this is possible as of rust-lang/rust-clippy#7631
2022-01-10 14:18:41 -06:00
Josh Stone
8f9b158df3 Update rayon and rustc-rayon 2022-01-10 11:34:07 -08:00
Taiki Endo
5f143c603e Warn disallowed_methods and disallowed_types by default 2022-01-11 02:17:14 +09:00
Taiki Endo
cf86cee4fe Downgrade mutex_atomic to nursery 2022-01-10 23:36:13 +09:00
bors
b66dbe87f1 Auto merge of #8228 - Jarcho:iter_not_returning_iterator_8225, r=giraffate
fix `iter_not_returning_iterator`

fixes #8225

changelog: Handle type projections in `iter_not_returning_iterator`
changelog: Don't lint `iter_not_returning_iterator` in trait implementations
changelog: Lint `iter_not_returning_iterator` in trait definitions
2022-01-10 12:34:15 +00:00
bors
1816361738 Auto merge of #8257 - camsteffen:internal-features, r=giraffate
Combine internal cargo features

changelog: none

This is just simpler and I don't see any downsides.
2022-01-10 12:18:05 +00:00
bors
88cfd70100 Auto merge of #8252 - dswij:8229, r=xFrednet
cover trait for `trait_duplication_in_bounds`

closes #8229

changelog: [`trait_duplication_in_bounds`] covers trait functions with `Self` bounds
2022-01-10 10:31:59 +00:00