Commit graph

9834 commits

Author SHA1 Message Date
bors
0b86340999 Auto merge of #6144 - rust-lang:float-cmp-ref, r=ebroto
allow refs in our constant folder

This helps with #3804 (but won't completely fix it).

---

changelog: none
2020-10-09 22:28:00 +00:00
bors
08bd3f0b0d Auto merge of #6152 - flip1995:ice_6139, r=ebroto
Fixes ICE 6139

Fixes #6139

Kind of hacky, but this should be fine.

changelog: none
2020-10-09 20:39:26 +00:00
flip1995
a98f9d21fc
(Hacky) Fix for ICE #6139 2020-10-09 22:22:21 +02:00
flip1995
6d88803a1c
Add regression test for ICE 6139 2020-10-09 22:21:47 +02:00
Andre Bogus
26e4de9557 allow refs in our constant handling 2020-10-09 21:37:50 +02:00
Sebastian Andersson
7b7ddfa55d Preserve raw strs for: format!(s) to s.to_string() lint
Ie:
|     let s = format!(r#""hello""#);
|             ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `r#""hello""#.to_string()`
2020-10-09 20:23:03 +02:00
hosseind75
3c94914f0c rebase with master 2020-10-09 20:57:45 +03:30
hosseind75
7f07577e6f add new line 2020-10-09 20:57:45 +03:30
hosseind75
49bc85e947 fix clippy custom_ice_message test 2020-10-09 20:57:45 +03:30
hosseind75
a9053e4baf run full query stack print just when RUST_BACKTRACE is set 2020-10-09 20:57:45 +03:30
hosseind75
ecd308ec39 ICEs should print the top of the query stack 2020-10-09 20:57:44 +03:30
bors
947516f018 Auto merge of #6130 - Ambroisie:lint-ptr-eq, r=Manishearth
New lint: Recommend using `ptr::eq` when possible

This is based almost entirely on the code available in the previous PR #4596. I merely updated the code to make it compile.

Fixes #3661.

- [ ] I'm not sure about the lint name, but it was the one used in the original PR.
- [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: none
2020-10-09 16:46:09 +00:00
bors
fcf22d90bb Auto merge of #6150 - flip1995:backport_doc_update, r=ebroto
Update backport documentation to the subtree workflow

changelog: none
2020-10-09 13:44:01 +00:00
bors
36e3c41368 Auto merge of #6149 - flip1995:update_actions, r=ebroto
Remove deprecated set-env from GHA

This updates all of our action dependencies and removes every usage of `set-env`. `set-env` and `add-path` has been deprecated: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

changelog: none
2020-10-09 13:23:01 +00:00
bors
ed2b457fbe Auto merge of #6148 - flip1995:release_doc, r=ebroto
Update release documentation

When updating the beta branch, we want to reset, instead of rebase. Otherwise we might produce again new commits on the beta branch, that aren't on the master branch.

changelog: none
2020-10-09 13:02:25 +00:00
bors
e87c028a2a Auto merge of #6131 - Ambroisie:fix-doc-tools, r=flip1995
Rename tables to typecheck_result()

While working on #6130, I noticed that part of the documentation was updated to use `LateContext::typeck_results`, but the paragraph still referred to the old `tables` field of `LateContext`.

---

*Please keep the line below*
changelog: none
2020-10-09 12:41:08 +00:00
bors
cad10fa3b3 Auto merge of #6146 - woshilapin:patch-1, r=flip1995
clippy_lint: Fix doc on 'option_if_let_else'

changelog: none
2020-10-09 12:20:29 +00:00
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