Commit graph

10185 commits

Author SHA1 Message Date
Samuel E. Moelius
9751cba2c6
Update clippy_lints/src/let_underscore.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-08 17:25:23 -05:00
Samuel E. Moelius
aa6bf1f90d
Update clippy_lints/src/let_underscore.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-08 17:24:55 -05:00
bors
2067a01ff1 Auto merge of #6267 - camsteffen:or-fun-idx, r=flip1995
Fix or_fun_call for index operator

changelog: Fix or_fun_call for index operator

Fixes #6266
2020-11-08 22:03:27 +00:00
Cameron Steffen
9cab08465b Fix or_fun_call for index operator 2020-11-08 14:49:42 -06:00
Cameron Steffen
b0994064b0 Make KNOW_TYPES static 2020-11-08 14:34:06 -06:00
bors
040d0ca4da Auto merge of #6288 - flip1995:changelog_internal, r=matthiaskrgr
Require the `changelog:` entry in the PR body to be modified

r? `@matthiaskrgr`

changelog: none
2020-11-08 19:37:25 +00:00
flip1995
7c612c1c50
Force contributors/reviewers to set _some_ changelog entry 2020-11-08 16:18:25 +01:00
bors
7079de9b35 Auto merge of #6293 - Urcra:lint-example-fix, r=flip1995
Fix example used in cargo_common_metadata

The previous example used in `cargo_common_metadata`  included an authors field, even though the comment says it doesn't. And thus doesn't actually demonstrate an example of how the lint fails.

This removes that authors field from the _bad_ example and suggest to fix the _bad_ example by adding the authors field

changelog: Fix example used in `cargo_common_metadata`
2020-11-08 14:24:58 +00:00
Samuel E. Moelius III
9c6a0b9c34 Update references 2020-11-08 07:07:49 -05:00
bors
b1faa7f002 Auto merge of #6271 - camsteffen:vec-box-import, r=flip1995
Fix vec_box scope error

changelog: Fix vec_box suggestion with wrong type scope

Fixes #6236
2020-11-08 12:02:30 +00:00
Samuel E. Moelius III
f1f780c942 Add let_underscore_drop 2020-11-08 07:00:35 -05:00
bors
abfa331f26 Auto merge of #6205 - josephlr:empty-loop2, r=flip1995
Enable empty_loop lint for no_std crates

Depends on #6162. Fixes #6161

We skip the lint if the `loop {}` is in the `#[panic_handler]` as the
main recommendation we give is to panic, which obviously isn't
possible in a panic handler.

changelog: Enable empty_loop lint for no_std crates
2020-11-08 11:41:22 +00:00
flip1995
00dee9d916
Update reference files 2020-11-08 12:40:41 +01:00
Joseph Richey
3579b7de24
Update clippy_lints/src/loops.rs
Fix NITs

Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-08 12:38:10 +01:00
Joe Richey
c6a91df838
Enable empty_loop lint for no_std crates
We skip the lint if the `loop {}` is in the `#[panic_handler]` as the
main recommendation we give is to panic, which obviously isn't
possible in a panic handler.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-11-08 12:38:10 +01:00
bors
96d5f45ade Auto merge of #6301 - alex-700:fix-map-clone, r=matthiaskrgr
do not trigger map_clone in the case of &mut

fixes #6299
changelog: do not trigger map_clone in the case of &mut
2020-11-08 01:28:27 +00:00
bors
c015622568 Auto merge of #6304 - matthiaskrgr:crash_6302, r=llogiq
FROM_ITER_INSTEAD_OF_COLLECT: avoid unwrapping unconditionally

Fixes #6302

changelog: fix unwrap of None when checking libcore with clippy
2020-11-07 18:10:35 +00:00
bors
5effc99812 Auto merge of #6298 - JohnTitor:fix-example, r=llogiq
Fix `await_holding_refcell_ref` examples for clarify

- Remove redundant `()`
- Fix variable name

changelog: none
2020-11-07 17:48:46 +00:00
bors
4aca13f56b Auto merge of #6287 - camsteffen:readme, r=llogiq
Readme improvements

~Moved the table of contents up, added an Overview heading.~

~Made the "All the Clippy Lints" link clearer.~

Formatted the lint categories as a table with the default lint level (instead of saying on/off by default). Tweaked the descriptions.

changelog: Improve Readme
2020-11-07 17:26:58 +00:00
bors
92ba07582e Auto merge of #6134 - patrickelectric:as_utf8, r=llogiq
Check when `from_utf8` is called from sliced byte array from string

---

*Please keep the line below*
changelog: Fix #5487: Add linter to check when `from_utf8` is called from sliced byte array from string.
2020-11-07 17:06:27 +00:00
bors
694cec12be Auto merge of #6110 - rail-rain:care_enums_non_copy_const, r=llogiq
"Respect" enums in `interior_mutable_const`

fixes #3962
fixes #3825

Hello,

It might not be a good idea to submit another relatively large PR while I have an opened PR; but, I've finished this anyway. This may be able to wait for months.

Note: the code uses the MIR interpreter, which the author of #3962 thought unlikely to be a solution. This might be over-engineering; but, I think it's important to be able to work with the 'http' crate (#3825). (And, I don't want to write a MIR visitor)

---

changelog: fix a false positive in two `interior_mutable_const` lints where a constant with enums gets linted
even if it uses a clearly unfrozen variant
2020-11-07 15:51:13 +00:00
bors
4bbef42c48 Auto merge of #6272 - camsteffen:unnecesary-lazy-eval-type, r=llogiq
Fix unnecessary_lazy_eval suggestion applicability

changelog: Fix unnecessary_lazy_eval suggestion applicability when breaking type inference

Fixes #6240
2020-11-07 10:01:46 +00:00
Matthias Krüger
5253595b3b FROM_ITER_INSTEAD_OF_COLLECT: avoid unwrapping unconditionally
Fixes #6302
2020-11-06 19:34:34 +01:00
bors
2ea08e1c53 Auto merge of #6294 - giraffate:fix_suggestion_to_add_space_in_manual_async, r=Manishearth
Fix suggestion to add unneeded space in `manual_async`

Fix a same case as https://github.com/rust-lang/rust-clippy/pull/6247

changelog: Fix suggestion to add unneeded space in `manual_async`
2020-11-06 18:10:43 +00:00
ThibsG
8242b2f0a4 Remove needless allow 2020-11-06 18:11:58 +01:00
Takayuki Nakata
b7892c6a26 Refactor to make getting position just before RArrow a common function 2020-11-06 22:54:38 +09:00
Aleksei Latyshev
5f57608604
do not trigger map_clone in the case of &mut 2020-11-06 14:38:46 +03:00
Takayuki Nakata
1624b00bde Fix suggestion to add unneeded space in manual_async 2020-11-06 08:40:43 +09:00
Yuki Okushi
1e4ce0fcaa Fix await_holding_refcell_ref examples for clarify 2020-11-06 04:02:41 +09:00
ThibsG
83e75f9207 Fix incorrect suggestion for try_err lint when Err arg is itself a macro 2020-11-05 18:00:34 +01:00
flip1995
34244190d4 Merge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup 2020-11-05 14:29:48 +01:00
bors
b20d4c155d Auto merge of #6296 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2020-11-05 13:14:26 +00:00
ThibsG
f83762b79c Skip rustfmt as it is wanted for this test 2020-11-05 09:14:20 +01:00
Patrick José Pereira
bc27d1492d Add string_from_utf8_as_bytes linter
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-11-04 21:17:46 -03:00
Cameron Steffen
fd8decee6a Readme improvements
Format lint categories as a table with the default lint level.
2020-11-04 17:29:19 -06:00
bors
0c1531a5c4 Auto merge of #78662 - sexxi-goose:add_expr_id_to_delegate, r=nikomatsakis
Provide diagnostic suggestion in ExprUseVisitor Delegate

The [Delegate trait](981346fc07/compiler/rustc_typeck/src/expr_use_visitor.rs (L28-L38)) currently use `PlaceWithHirId` which is composed of Hir `Place` and the
corresponding expression id.

Even though this is an accurate way of expressing how a Place is used,
it can cause confusion during diagnostics.

Eg:

```
let arr : [String; 5];

let [a, ...]     =   arr;
 ^^^ E1 ^^^      =  ^^E2^^
 ```

 Here `arr` is moved because of the binding created E1. However, when we
 point to E1 in diagnostics with the message `arr` was moved, it can be
 confusing.  Rather we would like to report E2 to the user.

 Closes: https://github.com/rust-lang/project-rfc-2229/issues/20

r? `@ghost`
2020-11-04 22:45:15 +00:00
bors
0d2f1aef02 Auto merge of #6247 - giraffate:fix_suggestion_to_add_space_in_unused_unit, r=ebroto
Fix suggestion to add unneeded space in `unused_unit`

Fix https://github.com/rust-lang/rust-clippy/issues/6230

changelog: Fix suggestion to add unneeded space in `unused_unit`
2020-11-04 22:42:10 +00:00
Urcra
a4acb3164a Fix example for cargo common data 2020-11-04 23:39:52 +01:00
bors
5b52474ae6 Auto merge of #5911 - hegza:issue-568, r=ebroto
Add lint for 'field_reassign_with_default` #568

changelog: Add lint for field_reassign_with_default that checks if mutable object + field modification is used to edit a binding initialized with Default::default() instead of struct constructor.

Fixes #568

Notes:
- Checks for reassignment of one or more fields of a binding initialized with Default::default().
- Implemented using EarlyLintPass, might be future proofed better with LateLintPass.
- Does not trigger if Default::default() is used via another type implementing Default.
- This is a re-open of [PR#4761](https://github.com/rust-lang/rust-clippy/pull/4761), but I couldn't figure out how to re-open that one so here's a new one with the requested changes :S
2020-11-04 22:21:44 +00:00
bors
62c0d29f17 Auto merge of #6292 - ebroto:rustup, r=ebroto
Rustup

changelog: none

r? `@ghost`
2020-11-04 21:53:32 +00:00
Eduardo Broto
f5166e81b1 Run cargo dev fmt 2020-11-04 22:41:15 +01:00
Eduardo Broto
834ad5c516 Merge remote-tracking branch 'upstream/master' into rustup 2020-11-04 22:37:11 +01:00
oli
83edb2f4e4 s/Scalar::Raw/Scalar::Int 2020-11-04 10:11:31 +00:00
Oliver Scherer
6fdbde5f46 Split the "raw integer bytes" part out of Scalar 2020-11-04 09:58:59 +00:00
bors
c2cf40cdcd Auto merge of #6284 - camsteffen:rustc-sym, r=flip1995
Use const sym where possible

I ran a regex search and replace to use const `sym` values where possible. This should give some performance boost by avoiding string interning at runtime.

Con: It is not as consistent as always using `sym!`.

I also changed an internal lint to suggest using `sym::{}`, making an assumption that this will always work for diagnostic items.

changelog: none
2020-11-04 09:22:54 +00:00
bors
3a34bc017d Auto merge of #6270 - ClashTheBunny:clarify_allow_deny_enable_disable, r=flip1995
Clarify allow/warn/deny documentation.  Remove enable/disable.

Disable and enable when not specifically explained were not clear to me
as an English language speaker, but I was able to figure it out fairly
easily due to the examples having A/W, which I assumed meant `allow` and
`warn`.  I removed both words to be sure it was clear as well as
extending the note on what deny means.  It now includes a statement on
exactly what each word means.

Documentation only update.

*Please keep the line below*
changelog: none
2020-11-04 08:49:10 +00:00
Randall Mason
cf2043d4a2 Update wording to avoid code having "lint" metaphor 2020-11-03 15:59:24 -06:00
Vadim Petrochenkov
c2a769f84c rustc_ast: visit_mac -> visit_mac_call 2020-11-03 23:39:51 +03:00
Vadim Petrochenkov
89fa373059 rustc_ast: Do not panic by default when visiting macro calls 2020-11-03 20:38:20 +03:00
bors
225ce5ff58 Auto merge of #6233 - montrivo:manual_ok_or, r=flip1995
add manual_ok_or lint

Implements partially #5923

changelog: add lint manual_ok_or
2020-11-03 16:42:59 +00:00