Commit Graph

9817 Commits

Author SHA1 Message Date
flip1995
7f846c930b
Update backport documentation to the subtree workflow 2020-10-09 14:16:59 +02:00
flip1995
fbf2430f02 Merge commit '2f6439ae6a6803d030cceb3ee14c9150e91b328b' into clippyup 2020-10-09 12:45:29 +02:00
flip1995
c4c9453ccf
Use defaults.run.shell instead of setting shell every time 2020-10-09 11:53:16 +02:00
flip1995
64a7d019f1
Remove all usage of set-env 2020-10-09 11:49:54 +02:00
bors
2f6439ae6a Auto merge of #6136 - dtolnay:serve, r=flip1995
Clippy dev subcommand to build and serve website

This PR adds `clippy dev serve` which will pop open a browser with a local rendered 'ALL the Clippy Lints' website, and re-render as you edit stuff.

---

changelog: none
2020-10-09 08:58:19 +00:00
bors
6fb3b2c160 Auto merge of #6115 - ebroto:changelog_1_48, r=flip1995
Add changelog for 1.48 beta

[Rendered](https://github.com/ebroto/rust-clippy/blob/changelog_1_48/CHANGELOG.md)

I've not added the PRs fixing `same_item_push` because those were backported, namely:
* [#5908](https://github.com/rust-lang/rust-clippy/pull/5908)
* [#5997](https://github.com/rust-lang/rust-clippy/pull/5997)
* [#6016](https://github.com/rust-lang/rust-clippy/pull/6016)

The following PR was reverted, so I've ignored it too:
* [#5984](https://github.com/rust-lang/rust-clippy/pull/5984)

~~Also, I took the liberty of adding a "Thanks" section, naming all the contributors to this release. I think they deserve visibility in the changelog. Please tell me if we want to add this or maybe it's redundant given we link to the PRs?~~

changelog: none

r? `@flip1995`
2020-10-09 08:09:23 +00:00
Jean SIMARD
732d370404
clippy_lint: Fix doc on 'option_if_let_else'
- a typo in `expresion`
- a useless double space
- Some back-tick quotes for 'if let'
2020-10-09 09:47:53 +02:00
flip1995
c85cb76064
Update release documentation 2020-10-09 09:40:57 +02:00
flip1995
2c8cd7d93c
Update actions due to deprecation of set-env and add-path 2020-10-09 09:17:48 +02:00
bors
195cc9be94 Auto merge of #6145 - flip1995:backport_remerge, r=flip1995
Backport remerge

Step 1 in the release process.

r? `@ghost`

changelog: none
2020-10-09 06:53:55 +00:00
flip1995
58375283e8
Merge remote-tracking branch 'upstream/beta' into backport_remerge 2020-10-09 08:52:06 +02:00
bors
e651a04fab Auto merge of #6133 - JPTIZ:no-box-for-c-ffi, r=ebroto
clippy_lints: Do not warn against Box parameter in C FFI

changelog: [`boxed_local`]: don't lint in `extern fn` arguments

Fixes #5542.

When using C FFI, to handle pointers in parameters it is needed to
declare them as `Box` in its Rust-side signature. However, the current
linter warns against the usage of Box stating that "local variable
doesn't need to be boxed here".

This commit fixes it by ignoring functions whose Abi is C.
2020-10-08 22:50:29 +00:00
João Paulo Taylor Ienczak Zanette
b709b87363 tests: Add test function that does not specify ABI 2020-10-08 18:50:52 -03:00
bors
265e4841b7 Auto merge of #6117 - dtolnay:string_lit_as_bytes, r=ebroto
Downgrade string_lit_as_bytes to nursery

Between #1402 (regarding `to_owned`) and #4494 (regarding `impl Read`), as well as other confusion I've seen hit in my work codebase involving string_lit_as_bytes (`"...".as_bytes().into()`), I don't think this lint is at a quality to be enabled by default.

I would consider re-enabling this lint after it is updated to understand when the surrounding type information is sufficient to unsize `b"..."` to &\[u8\] without causing a type error.

As currently implemented, this lint is pushing people to write `&b"_"[..]` which is not an improvement over `"_".as_bytes()` as far as I am concerned.

---

changelog: Remove string_lit_as_bytes from default set of enabled lints
2020-10-08 21:33:32 +00:00
Darshan Kathiriya
1385eb9b55 Replace run_compiler with RunCompiler builder pattern.
RunCompiler::new takes non-optional params, and optional
params can be set using set_*field_name* method.
finally `run` will forward all fields to `run_compiler`.
2020-10-08 16:11:45 -03:00
bors
6bfc19c687 Auto merge of #6138 - giraffate:note_that_we_follow_rustc_no_merge_policy, r=Manishearth
Add note that we follow a rustc no merge-commit policy

I think it would be better to add a note that we follow a rustc no merge-commit policy. For example, it was mentioned at https://github.com/rust-lang/rust-clippy/pull/5694#issuecomment-641871096.

changelog: none
2020-10-08 16:56:14 +00:00
Takayuki Nakata
fd61686ad5 Add note that we follow a rustc no merge-commit policy 2020-10-08 23:13:06 +09:00
David Tolnay
e6a71066c8
Clippy dev subcommand to build and serve website 2020-10-08 06:43:02 -07:00
João Paulo Taylor Ienczak Zanette
5ae0f2644d clippy_lint: extern definition is in Rust, not C 2020-10-08 09:07:24 -03:00
João Paulo Taylor Ienczak Zanette
418cde0389 clippy_lint: Fix typo (now -> not) 2020-10-08 09:06:19 -03:00
João Paulo Taylor Ienczak Zanette
cc26924cce clippy_lint: Extend BoxedLocal ignored ABI to all non-rust ABIs. 2020-10-08 09:03:11 -03:00
David Tolnay
c81bea45f4
Make clippy_lints's doc tests succeed 2020-10-08 04:54:17 -07:00
David Tolnay
3a6f59ecae
Document string_lit_as_bytes known problems 2020-10-08 04:50:24 -07:00
bors
171ab9bf9f Auto merge of #6132 - rust-lang:regex-unicode, r=ebroto
Fix unicode regexen with bytes::Regex

fixes #6005

The rationale for this is that since we wrote that lint, `bytes::Regex` was extended to be able to use unicode character classes.

---

changelog: [`invalid_regex`]: allow unicode character classes in bytes regex.
2020-10-08 08:48:12 +00:00
João Paulo Taylor Ienczak Zanette
15150c07ea clippy_lint: Test for BoxedLocal false-positive in C-FFI and fix C-FFI Abi comparison. 2020-10-07 22:49:50 -03:00
João Paulo Taylor Ienczak Zanette
738ed38306 clippy_lints: Do not warn against Box parameter in C FFI
Fixes #5542.

When using C FFI, to handle pointers in parameters it is needed to
declare them as `Box` in its Rust-side signature. However, the current
linter warns against the usage of Box stating that "local variable
doesn't need to be boxed here".

This commit fixes it by ignoring functions whose Abi is Cdecl.
2020-10-07 21:41:54 -03:00
bors
13a80b34ba Auto merge of #6128 - dtolnay:rc_buffer, r=yaahc
Downgrade rc_buffer to restriction

I think Arc\<Vec\<T\>\> and Arc\<String\> and similar are a totally reasonable data structure, as observed by others in the comments on [#6044](https://github.com/rust-lang/rust-clippy/pull/6044#event-3799579830) as well. Doing `Arc::make_mut(&mut self.vec).push(...)` or `Arc::make_mut(&mut self.string).push_str("...")` is a terrific and well performing copy-on-write pattern. Linting this with an enabled-by-default <kbd>performance</kbd> lint strikes me as an unacceptable false positive balance.

As of #6090 the documentation of this lint now contains:

> **Known problems:** This pattern can be desirable ...

which should indicate that we shouldn't be linting against correct, reasonable, well-performing patterns with an enabled-by-default lint.

Mentioning #6044, #6090.
r? `@yaahc,` who reviewed the lint.

---

changelog: Remove rc_buffer from default set of enabled lints
2020-10-07 23:10:34 +00:00
Andre Bogus
11672577de Fix unicode regexen with bytes::Regex
fixes #6005
2020-10-08 01:07:00 +02:00
Bruno BELANYI
6edde811b5
fixup! New lint: Recommend using ptr::eq when possible
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2020-10-07 17:11:11 +02:00
Bruno BELANYI
326090dbb8
fixup! Rename tables to typecheck_result()
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2020-10-07 17:10:31 +02:00
Bruno BELANYI
9ef311b477 Rename tables to typecheck_result() 2020-10-07 11:59:20 +02:00
Bruno BELANYI
aa7c42f756 fixup! New lint: Recommend using ptr::eq when possible
Add missing modified files.
2020-10-07 11:54:09 +02:00
Bruno BELANYI
5bad9175fb New lint: Recommend using ptr::eq when possible
This is based almost entirely on the code available in the previous PR #4596.
2020-10-07 11:48:06 +02:00
bors
277191890b Auto merge of #6120 - phansch:replace-lazy-static, r=Manishearth
Replace some lazy_static usage with once_cell feature

This replaces some `lazy_static` usage with [`SyncLazy`](https://doc.rust-lang.org/nightly/std/lazy/struct.SyncLazy.html) of the unstable `once_cell` feature.

changelog: none
2020-10-07 04:58:13 +00:00
David Tolnay
0e159a55d6
Downgrade rc_buffer to restriction 2020-10-06 19:46:03 -07:00
David Tolnay
a5ef305cb5
Downgrade string_lit_as_bytes to nursery 2020-10-06 19:41:22 -07:00
bors
14e72696a6 Auto merge of #6124 - pickfire:patch-1, r=flip1995
Use more concrete explanation for methods

*Please keep the line below*
changelog: none
2020-10-06 23:22:28 +00:00
bors
c8d89ba5d5 Auto merge of #6127 - ebroto:reinstate_forbid_restriction, r=flip1995
Reinstate test for forbid(clippy::restriction)

In [this commit](5747c15961) coming from rust-lang/rust (#6126) the test for `#![forbid(clippy::restriction)]` was removed because some restriction lints were being allowed after the forbid.

This change reinstates the test for `forbid` by using a separate file.

changelog: none

r? `@flip1995`
2020-10-06 22:33:57 +00:00
Eduardo Broto
6c3611bdef Reinstate test for forbid blanket restriction 2020-10-07 00:02:28 +02:00
bors
1a4175bcec Auto merge of #6126 - flip1995:rustup, r=flip1995
Rustup

Supersedes #6121. There was another breakage.

r? `@ghost`

changelog: none
2020-10-06 21:34:50 +00:00
flip1995
b05aeaa9bc
Run fmt 2020-10-06 23:32:38 +02:00
Ivan Tham
7021d70d2e
Use more concrete explanation for methods
Show some code rather than "a single method call".
2020-10-06 23:58:32 +08:00
Philipp Hansch
da57a16872
clippy_lints: Replace lazy_static with SyncLazy 2020-10-06 14:39:04 +02:00
Matthew Jasper
adb7fc6283 Fix tools 2020-10-06 11:19:30 +01:00
Yuki Okushi
22c5e0c347 Rollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr
Fix LitKind's byte buffer to use refcounted slice

While working on adding a new lint for clippy (see https://github.com/rust-lang/rust-clippy/pull/6044) for avoiding shared ownership of "mutable buffer" types (such as using `Rc<Vec<T>>` instead of `Rc<[T]>`), I noticed a type exported from rustc_ast and used by clippy gets caught by the lint. This PR fixes the exported type.

This PR includes the actual change to clippy too, but I will open a PR directly against clippy for that part (although it will currently fail to build there).
2020-10-06 16:26:11 +09:00
Yuki Okushi
a7b721968a Rollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in-same-scope, r=petrochenkov
Disallow overriding forbid in same scope

Rebased #73379.

Fixes #70819.
2020-10-06 16:26:04 +09:00
bors
c9fdeef643 Auto merge of #6078 - ebroto:unnecessary_sort_by_take_2, r=phansch
unnecessary sort by: avoid dereferencing the suggested closure parameter

This change tries to simplify the solution for problematic cases but is less restrictive than  #6006.

* We can't dereference shared references to non-Copy types, so the new suggestion does not do that. Note that this implies that the suggested closure parameter will be a reference.
* We can't take a reference to the closure parameter in the returned key, so we don't lint in those cases. This can happen either because the key borrows from the parameter (e.g. `|a| a.borrows()`), or because we suggest `|a| Reverse(a)`. If we did we would hit this error:
```
error: lifetime may not live long enough
  --> /home/ebroto/src/ebroto-clippy/tests/ui/unnecessary_sort_by.fixed:19:25
   |
19 |     vec.sort_by_key(|b| Reverse(b));
   |                      -- ^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
   |                      ||
   |                      |return type of closure is Reverse<&'2 isize>
   |                      has type `&'1 isize`

error: aborting due to previous error
```

Note that Clippy does not currently have the (MIR-based) machinery necessary to check that what is borrowed is actually the closure parameter.

changelog: [`unnecessary_sort_by`]: avoid dereferencing the suggested closure parameter

Fixes #6001
2020-10-06 06:59:33 +00:00
Philipp Hansch
9b4ceee593
integration tests: Replace lazy_static with SyncLazy 2020-10-06 08:20:18 +02:00
Philipp Hansch
4b459596a9
clippy_dev: Replace lazy_static with SyncLazy 2020-10-06 08:18:11 +02:00
Eduardo Broto
13781ae2f8 Remove "thanks" section 2020-10-06 00:09:45 +02:00