Commit Graph

10360 Commits

Author SHA1 Message Date
Philipp Hansch
0afe2dbad8
Update CHANGELOG for Rust 1.50 2020-12-30 17:10:07 +01:00
Joshua Nelson
5479bbaf72 Rename kw::Invalid -> kw::Empty
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471
for context.
2020-12-30 09:50:02 -05:00
ThibsG
af480a67be Ensure Copy exception in trait definition for wrong_self_convention lint 2020-12-30 12:02:26 +01:00
Aaron Hill
6fd18f95ca Remove unnecessary semicolon from Clippy test 2020-12-29 17:16:04 -05:00
nahuakang
275988cb73 Add additional lint doc to known problems section 2020-12-28 20:45:56 +01:00
nahuakang
83a458acf1 Enable never type in empty enum ui test; run cargo dev bless 2020-12-28 20:18:27 +01:00
bors
0d8a27a6f6 Auto merge of #6510 - alex-700:fix-ptr-arg-lint, r=llogiq
don't ignore expression after first not matched method call in PtrCloneVisitor

fixes #6509

changelog: none
2020-12-28 19:04:30 +00:00
nahuakang
469281c0dd Check if never type feature is enabled by TyCtxt before suggesting empty enum lint 2020-12-28 18:59:35 +01:00
Aleksei Latyshev
203715aa4e
don't ignore expression after first not matched method call in PtrCloneVisitor 2020-12-28 01:09:04 +03:00
bors
61a3ee7935 Auto merge of #6506 - alex-700:add-path-buf-to-ptr-arg-lint, r=Manishearth
Lint "&PathBuf instead of &Path" in PTR_ARG

fixes #6502

changelog: lint "`&PathBuf` instead of `&Path`" in `PTR_ARG`
2020-12-27 17:59:52 +00:00
bors
3661848997 Auto merge of #6375 - camsteffen:reassign-default-private, r=flip1995
Reassign default private

changelog: fix field_reassign_with_default false positive

* Fix #6344
* Fix assumption that `field: Default::default()` is the same as `..Default::default()`
* Cleanup some redundant logic
2020-12-27 16:20:47 +00:00
bors
015496579d Auto merge of #6495 - matthiaskrgr:FN_FP_issue_templates, r=flip1995
ISSUE_TEMPLATE: add templates for false negative and false positive tickets.

These will add the correct labels automatically so we don't have to do that ourselves :)

changelog: none
2020-12-27 12:53:04 +00:00
bors
b1e0d15d58 Auto merge of #6505 - giraffate:fix_style_of_texts_in_map_err_ignore, r=phansch
Fix a style of texts in `map_err_ignore`

It's a small fix of texts.

changelog: none
2020-12-25 15:47:31 +00:00
Aleksei Latyshev
dfaea9c967
lint &PathBuf instead of &Path in PTR_ARG
- extract get_only_generic_arg_snippet to improve readability
2020-12-25 15:06:34 +03:00
Takayuki Nakata
e1743ef525 Fix a style of texts in map_err_ignore 2020-12-25 08:59:34 +09:00
bors
02399f4b25 Auto merge of #6504 - matthiaskrgr:cifix, r=matthiaskrgr
fix ci on master branch; run the --fix test in the correct directory

Turned out the --fix test was run in the wrong directory.

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: none
2020-12-24 13:37:08 +00:00
Matthias Krüger
2218dd6554 ci: run cargo clippy --fix -Zunstable-options in the correct directory. 2020-12-24 13:57:39 +01:00
Matthias Krüger
3687de2159 ISSUE_TEMPLATE: add templates for false negative and false positive tickets. 2020-12-23 12:28:16 +01:00
flip1995
88491e2a51 Special sync of 'e89801553ddbaccdeb2eac4db08900edb51ac7ff' 2020-12-23 10:57:35 +01:00
bors
5c981359a8 Auto merge of #6483 - xFrednet:5386-github-ticket-search, r=killercup
Website issue tracker link and better search performance

This PR implements some improvements to the website:
1. Added a "Search on Github" link to the "Known problems" section (Closes #5386)
    ![example_3](https://user-images.githubusercontent.com/17087237/102718215-e9f12500-42de-11eb-8c1b-487f8184aaf7.png)
    <details>
    <summary>Another mock up I created with the GitHub logo</summary>

    ![example_2](https://user-images.githubusercontent.com/17087237/102718281-3472a180-42df-11eb-99b8-7f6d76da2b55.png)

    </details>

2. Only starting the search after three letters and improving the search performance in general. (Followup #6477)

### Testing
These changes can be tested locally by:
1. Clone this branch
2. Download the current lint index from the [gh-pages branch](https://github.com/rust-lang/rust-clippy/blob/gh-pages/master/lints.json)
3. Put it next to the `util/gh-pages/index.html` and open the html file. Make sure that it can load the lint data. (Browsers can be a bit iffy when opening a local html page and loading data)

### Sources for search performance:
1. [A stackoverflow about angular filter performance](https://stackoverflow.com/questions/26876514/optimize-angular-filter-performance)
    * I selected a search debounce of 50ms that's fast enough to catch fast deletion and typing but responsive enough to not bother the user
2. [A stackoverflow about string comparison speeds](https://stackoverflow.com/questions/5296268/fastest-way-to-check-a-string-contain-another-substring-in-javascript)
3. [JS benchmarks for string search performance (`indexOf` seams to be the best)](https://jsben.ch/9cwLJ)

Note: The performance is still a bit poor when going from a specific lint to no search filter. I suspect that angular is recreating all lint items when the filter is cleared causing a major lag spike. The filter functions is at least optimized for little to no search.

---

changelog: Added a "Search on GitHub" link to the website
2020-12-23 00:25:05 +00:00
bors
971e5b33da Auto merge of #6496 - matthiaskrgr:test_fix, r=Manishearth
ci: test cargo clippy --fix -Zunstable-options

Make sure we catch cases like https://github.com/rust-lang/rust-clippy/issues/6487 in CI in the future.

---

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: none
2020-12-22 22:59:21 +00:00
bors
4772eb8d1b Auto merge of #6498 - rust-lang:revert-6441-use_rustflags, r=ebroto
Revert "Pass Clippy args also trough RUSTFLAGS"

Reverts rust-lang/rust-clippy#6441

r? `@ebroto`

changelog: Revert "Pass Clippy args also trough RUSTFLAGS"
2020-12-22 22:39:09 +00:00
xFrednet
f055e7f2e9 Fixed a value spelling mistake 2020-12-22 20:02:59 +00:00
Philipp Krones
7fa1d78c89
Revert "Pass Clippy args also trough RUSTFLAGS" 2020-12-22 19:17:59 +01:00
Cameron Steffen
c6450c70dd Fix field_reassign_with_default for private fields 2020-12-22 11:09:46 -06:00
Cameron Steffen
73ce34a197 Remove redundant shadow check
There is already an assertion that consecutive lines assign to a struct
field.
2020-12-22 10:51:56 -06:00
Cameron Steffen
8bdf34e10c Fix default initialized fields in suggestion
The default value for a field type does not necessarily match the
default value for that field in the struct Default.
2020-12-22 10:51:56 -06:00
bors
1f9e4cbe0d Auto merge of #6494 - matthiaskrgr:readme_, r=flip1995
readme: remove paragraph about executing clippy via "cargo run .."

This most likely no longer works since we are pinning clippy on a specific nightly now.
"cargo run" would try to compile clippy with whatever version the project we want to check demands.

Also building clippy yourself to run it on a project is not really needed anymore since clippy is shipped with official rust releases.

Fixes #6489

changelog: none
2020-12-22 15:32:45 +00:00
bors
25e9acb253 Auto merge of #6476 - 1c3t3a:1c3t3a-from-over-into, r=llogiq
Added from_over_into lint

Closes #6456
Added a lint that searches for implementations of `Into<..>` and suggests to implement `From<..>` instead, as it comes with a default implementation of `Into`. Category: style.

changelog: added `from_over_into` lint
2020-12-22 12:06:08 +00:00
bors
4b233c83a4 Auto merge of #6497 - matthiaskrgr:clone_1, r=flip1995
remove clone in manual_async_fn lint

changelog: none
2020-12-22 08:55:05 +00:00
Matthias Krüger
af22613a25 remove clone in manual_async_fn lint 2020-12-22 03:12:12 +01:00
Matthias Krüger
d6a7ebcdd6 ci: test cargo clippy --fix -Zunstable-options 2020-12-22 02:01:16 +01:00
Matthias Krüger
04d3044837 readme: remove paragraph about executing clippy via "cargo run .."
This most likely no longer works since we are pinning clippy on a specific nightly now.
"cargo run" would try to compile clippy with whatever version the project we want to check demands.

Also building clippy yourself to run it on a project is not really needed anymore since clippy is shipped with official rust releases.

Fixes #6489
2020-12-22 01:24:59 +01:00
bors
51947df56f Auto merge of #6485 - phansch:macro-check-large-enum-variant, r=llogiq
Don't trigger large_enum_variant in external macros

Closes #1776 (the potential JSON output issue is not something we can fix in Clippy and I can't reproduce it anymore)

changelog: Don't trigger [`large_enum_variant`] in external macros
2020-12-21 23:49:51 +00:00
Bastian Kersting
53f4d437f4
Update from_over_into.stderr 2020-12-21 17:15:05 +01:00
bors
400d40b4ce Auto merge of #6488 - matthiaskrgr:readme_clp, r=flip1995
readme: remove paragraph about installing clippy manually on ci, if it is missing on a nightly

Clippy should always be available on nightly because we are gating on it in rustcs CI.

changelog: remove outdated readme paragraph
2020-12-21 15:31:07 +00:00
Matthias Krüger
19ace28af4 readme: remove paragraph about installing clippy manually on ci, if it is missing on a nightly
Clippy should always be available on nightly because we are gating on it in rustcs CI.
2020-12-21 16:11:40 +01:00
Philipp Hansch
12bd244caa
Don't trigger large_enum_variant in external macros 2020-12-21 11:09:49 +01:00
llogiq
0d6c128bfd
Update clippy_lints/src/from_over_into.rs
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2020-12-21 09:18:30 +01:00
Bastian Kersting
7e641c8be7 Fixed error messages 2020-12-20 22:00:34 +01:00
flip1995
f03edfd7a1 Merge commit '4911ab124c481430672a3833b37075e6435ec34d' into clippyup 2020-12-20 17:19:49 +01:00
xFrednet
97f5db97c4 Website issue tracker link and better search performance
* last minor improvements
2020-12-20 16:14:24 +00:00
bors
4911ab124c Auto merge of #6482 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2020-12-20 16:00:11 +00:00
flip1995
53d6e0caaa
Bump nightly to 2020-12-20 2020-12-20 16:54:22 +01:00
flip1995
883a3d10c8
Merge remote-tracking branch 'upstream/master' into rustup 2020-12-20 16:48:04 +01:00
Bastian Kersting
dd005c17e7 Added MSRV and fixed typo 2020-12-20 13:00:17 +01:00
bors
12a35abba1 Auto merge of #6477 - xFrednet:0000-enable-search-with-dashes, r=ebroto
Adapted the website search for better matching

* This adds the ability to search for ids with dashes and spaces in the name.
    * Example: `missing-errors-doc` and `missing errors doc` are now valid aliases for lint names
* It also improves the fuzzy search in the description. This search will now match any lint that where all searched words are inside the description.
    * Example: `doc section` finds two lints in our selection

This was suggested/discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Enable.20lint.20search.20with.20dashes/near/220469464)

### Testing
These changes can be tested locally by:
1. Clone this branch
2. Download the current lint index from the [gh-pages branch](https://github.com/rust-lang/rust-clippy/blob/gh-pages/master/lints.json)
3. Put it next to the `util/gh-pages/index.html` and open the html file. Make sure that it can load the lint data. (Browsers can be a bit iffy when opening a loacl html page and loading data)

### Note
I found that searching only a few characters (< 3) seams slow and deleting one even more as almost every lint description contains them. This also happens in our current [lint list](https://rust-lang.github.io/rust-clippy/master/index.html). We could change the search to only be triggered if the search field contains more than 3 letters to slightly improve performance.

---

changelog: Adapted the website search for better matching
2020-12-19 22:01:45 +00:00
bors
9f9e9f7e52 Auto merge of #6316 - ThibsG:WrongSelfConventionTraitDef, r=ebroto
Lint also in trait def for `wrong_self_convention`

Extends `wrong_self_convention` to lint also in trait definition.

By the way, I think the `wrong_pub_self_convention` [example](dd826b4626/clippy_lints/src/methods/mod.rs (L197)) is misleading.
On [playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=32615ab3f6009e7e42cc3754be0ca17f), it fires `wrong_self_convention`, so the example (or the lint maybe?) needs to be reworked.
The difference with `wrong_self_convention` [example](dd826b4626/clippy_lints/src/methods/mod.rs (L172)) is mainly the `pub` keyword on the method `as_str`, but the lint doesn't use the function visibility as condition to choose which lint to fire (in fact it uses the visibility of the impl item).

fixes: #6307

changelog: Lint `wrong_self_convention` lint in trait def also
2020-12-19 21:39:19 +00:00
xFrednet
2814ee4840 Adapted the website search for better matching
* Formatting
2020-12-19 16:28:16 +00:00
Bastian Kersting
a451b2af30 Added from_over_into lint 2020-12-19 17:00:40 +01:00