]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoInitial support for Rust 2021.
Mara Bos [Fri, 1 Jan 2021 15:21:31 +0000 (16:21 +0100)]
Initial support for Rust 2021.

Clippy treated Rust 2021 as Rust 2015, because 2018 was checked with
`==` instead of `>=`. This fixes that, such that 2018-specific things
are also enabled for 2021.

3 years agoAuto merge of #6526 - matthiaskrgr:version, r=Manishearth
bors [Fri, 1 Jan 2021 09:01:32 +0000 (09:01 +0000)]
Auto merge of #6526 - matthiaskrgr:version, r=Manishearth

make clippy version number correspond to rustc version number.

clippy 0.1.50 corresponds to rustc 1.50.x

This bumps the clippy version number from 0.0.212 to 0.1.50

Fixes #6499

Notes:
I used `cargo --version` because that way we can honour the version set in the `rust-toolchain` file.
When we bump the bootstrap compiler from 1.50 to 1.51, the version numbers will have to be changed to 1.51 or the test will fail.

---

changelog: make clippy version number correspond to rustc version number (rust 1.50.0 -> clippy 0.1.50)

3 years agomake clippy version number correspond to rustc version number.
Matthias Krüger [Thu, 31 Dec 2020 15:07:20 +0000 (16:07 +0100)]
make clippy version number correspond to rustc version number.

clippy 0.1.50 corresponds to rustc 1.50.x

This bumps the clippy version number from 0.0.212 to 0.1.50

Fixes #6499

3 years agoAuto merge of #6510 - alex-700:fix-ptr-arg-lint, r=llogiq
bors [Mon, 28 Dec 2020 19:04:30 +0000 (19:04 +0000)]
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

3 years agodon't ignore expression after first not matched method call in PtrCloneVisitor
Aleksei Latyshev [Sun, 27 Dec 2020 22:09:04 +0000 (01:09 +0300)]
don't ignore expression after first not matched method call in PtrCloneVisitor

3 years agoAuto merge of #6506 - alex-700:add-path-buf-to-ptr-arg-lint, r=Manishearth
bors [Sun, 27 Dec 2020 17:59:52 +0000 (17:59 +0000)]
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`

3 years agoAuto merge of #6375 - camsteffen:reassign-default-private, r=flip1995
bors [Sun, 27 Dec 2020 16:20:47 +0000 (16:20 +0000)]
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

3 years agoAuto merge of #6495 - matthiaskrgr:FN_FP_issue_templates, r=flip1995
bors [Sun, 27 Dec 2020 12:53:04 +0000 (12:53 +0000)]
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

3 years agoAuto merge of #6505 - giraffate:fix_style_of_texts_in_map_err_ignore, r=phansch
bors [Fri, 25 Dec 2020 15:47:31 +0000 (15:47 +0000)]
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

3 years agolint &PathBuf instead of &Path in PTR_ARG
Aleksei Latyshev [Fri, 25 Dec 2020 11:45:04 +0000 (14:45 +0300)]
lint &PathBuf instead of &Path in PTR_ARG

- extract get_only_generic_arg_snippet to improve readability

3 years agoFix a style of texts in `map_err_ignore`
Takayuki Nakata [Thu, 24 Dec 2020 23:59:34 +0000 (08:59 +0900)]
Fix a style of texts in `map_err_ignore`

3 years agoAuto merge of #6504 - matthiaskrgr:cifix, r=matthiaskrgr
bors [Thu, 24 Dec 2020 13:37:08 +0000 (13:37 +0000)]
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

3 years agoci: run cargo clippy --fix -Zunstable-options in the correct directory.
Matthias Krüger [Thu, 24 Dec 2020 12:11:34 +0000 (13:11 +0100)]
ci: run cargo clippy --fix -Zunstable-options in the correct directory.

3 years agoISSUE_TEMPLATE: add templates for false negative and false positive tickets.
Matthias Krüger [Tue, 22 Dec 2020 00:37:49 +0000 (01:37 +0100)]
ISSUE_TEMPLATE: add templates for false negative and false positive tickets.

3 years agoAuto merge of #6483 - xFrednet:5386-github-ticket-search, r=killercup
bors [Wed, 23 Dec 2020 00:25:05 +0000 (00:25 +0000)]
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

3 years agoAuto merge of #6496 - matthiaskrgr:test_fix, r=Manishearth
bors [Tue, 22 Dec 2020 22:59:21 +0000 (22:59 +0000)]
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

3 years agoAuto merge of #6498 - rust-lang:revert-6441-use_rustflags, r=ebroto
bors [Tue, 22 Dec 2020 22:39:09 +0000 (22:39 +0000)]
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"

3 years agoFixed a value spelling mistake
xFrednet [Tue, 22 Dec 2020 20:02:59 +0000 (20:02 +0000)]
Fixed a value spelling mistake

3 years agoRevert "Pass Clippy args also trough RUSTFLAGS"
Philipp Krones [Tue, 22 Dec 2020 18:17:59 +0000 (19:17 +0100)]
Revert "Pass Clippy args also trough RUSTFLAGS"

3 years agoFix field_reassign_with_default for private fields
Cameron Steffen [Mon, 23 Nov 2020 15:23:24 +0000 (09:23 -0600)]
Fix field_reassign_with_default for private fields

3 years agoRemove redundant shadow check
Cameron Steffen [Mon, 23 Nov 2020 19:20:53 +0000 (13:20 -0600)]
Remove redundant shadow check

There is already an assertion that consecutive lines assign to a struct
field.

3 years agoFix default initialized fields in suggestion
Cameron Steffen [Mon, 23 Nov 2020 18:26:35 +0000 (12:26 -0600)]
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.

3 years agoAuto merge of #6494 - matthiaskrgr:readme_, r=flip1995
bors [Tue, 22 Dec 2020 15:32:45 +0000 (15:32 +0000)]
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

3 years agoAuto merge of #6476 - 1c3t3a:1c3t3a-from-over-into, r=llogiq
bors [Tue, 22 Dec 2020 12:06:08 +0000 (12:06 +0000)]
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

3 years agoAuto merge of #6497 - matthiaskrgr:clone_1, r=flip1995
bors [Tue, 22 Dec 2020 08:55:05 +0000 (08:55 +0000)]
Auto merge of #6497 - matthiaskrgr:clone_1, r=flip1995

remove clone in manual_async_fn lint

changelog: none

3 years agoremove clone in manual_async_fn lint
Matthias Krüger [Tue, 22 Dec 2020 02:11:35 +0000 (03:11 +0100)]
remove clone in manual_async_fn lint

3 years agoci: test cargo clippy --fix -Zunstable-options
Matthias Krüger [Tue, 22 Dec 2020 00:57:55 +0000 (01:57 +0100)]
ci: test cargo clippy --fix -Zunstable-options

3 years agoreadme: remove paragraph about executing clippy via "cargo run .."
Matthias Krüger [Tue, 22 Dec 2020 00:24:59 +0000 (01:24 +0100)]
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

3 years agoAuto merge of #6485 - phansch:macro-check-large-enum-variant, r=llogiq
bors [Mon, 21 Dec 2020 23:49:51 +0000 (23:49 +0000)]
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

3 years agoUpdate from_over_into.stderr
Bastian Kersting [Mon, 21 Dec 2020 16:15:05 +0000 (17:15 +0100)]
Update from_over_into.stderr

3 years agoAuto merge of #6488 - matthiaskrgr:readme_clp, r=flip1995
bors [Mon, 21 Dec 2020 15:31:07 +0000 (15:31 +0000)]
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

3 years agoreadme: remove paragraph about installing clippy manually on ci, if it is missing...
Matthias Krüger [Mon, 21 Dec 2020 15:11:40 +0000 (16:11 +0100)]
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.

3 years agoDon't trigger large_enum_variant in external macros
Philipp Hansch [Mon, 21 Dec 2020 10:09:49 +0000 (11:09 +0100)]
Don't trigger large_enum_variant in external macros

3 years agoUpdate clippy_lints/src/from_over_into.rs
llogiq [Mon, 21 Dec 2020 08:18:30 +0000 (09:18 +0100)]
Update clippy_lints/src/from_over_into.rs

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
3 years agoFixed error messages
Bastian Kersting [Sun, 20 Dec 2020 19:10:00 +0000 (20:10 +0100)]
Fixed error messages

3 years agoWebsite issue tracker link and better search performance
xFrednet [Sun, 20 Dec 2020 15:53:23 +0000 (15:53 +0000)]
Website issue tracker link and better search performance

* last minor improvements

3 years agoAuto merge of #6482 - flip1995:rustup, r=flip1995
bors [Sun, 20 Dec 2020 16:00:11 +0000 (16:00 +0000)]
Auto merge of #6482 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump nightly to 2020-12-20
flip1995 [Sun, 20 Dec 2020 15:48:26 +0000 (16:48 +0100)]
Bump nightly to 2020-12-20

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Sun, 20 Dec 2020 15:25:54 +0000 (16:25 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAdded MSRV and fixed typo
Bastian Kersting [Sun, 20 Dec 2020 12:00:17 +0000 (13:00 +0100)]
Added MSRV and fixed typo

3 years agoAuto merge of #6477 - xFrednet:0000-enable-search-with-dashes, r=ebroto
bors [Sat, 19 Dec 2020 22:01:45 +0000 (22:01 +0000)]
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

3 years agoAuto merge of #6316 - ThibsG:WrongSelfConventionTraitDef, r=ebroto
bors [Sat, 19 Dec 2020 21:39:19 +0000 (21:39 +0000)]
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](https://github.com/rust-lang/rust-clippy/blob/dd826b4626c00da53f76f00f02f03556803e9cdb/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](https://github.com/rust-lang/rust-clippy/blob/dd826b4626c00da53f76f00f02f03556803e9cdb/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

3 years agoAdapted the website search for better matching
xFrednet [Sat, 19 Dec 2020 16:12:36 +0000 (16:12 +0000)]
Adapted the website search for better matching

* Formatting

3 years agoAdded from_over_into lint
Bastian Kersting [Sat, 19 Dec 2020 14:49:42 +0000 (15:49 +0100)]
Added from_over_into lint

3 years agoAuto merge of #6473 - phansch:split-up-ui-test, r=flip1995
bors [Sat, 19 Dec 2020 13:58:22 +0000 (13:58 +0000)]
Auto merge of #6473 - phansch:split-up-ui-test, r=flip1995

UI Tests: Separate suspicious_else_formatting tests

Was briefly looking into https://github.com/rust-lang/rust-clippy/issues/3864 when I saw that the tests could benefit from being in their own file.

---
changelog: none

3 years agoUI Tests: Separate suspicious_else_formatting tests
Philipp Hansch [Sat, 19 Dec 2020 12:54:38 +0000 (13:54 +0100)]
UI Tests: Separate suspicious_else_formatting tests

3 years agoAuto merge of #6471 - phansch:fix-bless, r=flip1995
bors [Sat, 19 Dec 2020 12:28:00 +0000 (12:28 +0000)]
Auto merge of #6471 - phansch:fix-bless, r=flip1995

Fix blessing of new reference files

Adding of new reference files wasn't handled correctly. It was trying to
read a file that didn't exist yet.

Instead of unwrapping, we now treat a missing reference file as empty
(`Vec::new`). This makes the following conditional work. We then also
have to re-read the reference file after it was being copied. This
second read is technically the same as in the old shell script, but
wasn't really obvious there. The shell script did a `-s` test which
reads the file as well.

changelog: internal: Fix `cargo dev bless` when new reference files are added

3 years agoMore rebinds
Jack Huey [Thu, 17 Dec 2020 03:36:14 +0000 (22:36 -0500)]
More rebinds

3 years agoFix blessing of new reference files
Philipp Hansch [Sat, 19 Dec 2020 07:25:42 +0000 (08:25 +0100)]
Fix blessing of new reference files

Adding of new reference files wasn't handled correctly. It was trying to
read a file that didn't exist yet.

Instead of unwrapping, we now treat a missing reference file as empty
(`Vec::new`). This makes the following conditional work. We then also
have to re-read the reference file after it was being copied. This
second read is technically the same as in the old shell script, but
wasn't really obvious. The shell script did a `-s` test which reads the
file.

3 years agoAuto merge of #6464 - ahouts:make-needless_update-ignore-non_exhaustive-structs,...
bors [Sat, 19 Dec 2020 07:35:04 +0000 (07:35 +0000)]
Auto merge of #6464 - ahouts:make-needless_update-ignore-non_exhaustive-structs, r=phansch

make needless_update ignore non_exhaustive structs

changelog: make `needless_update` lint ignore `non_exhaustive` structs

fixes #6323

3 years agoremove example
Andrew Houts [Sat, 19 Dec 2020 01:15:05 +0000 (19:15 -0600)]
remove example

3 years agoAuto merge of #6470 - xFrednet:0000-rename-good-first-issue-in-docs, r=flip1995
bors [Fri, 18 Dec 2020 22:40:08 +0000 (22:40 +0000)]
Auto merge of #6470 - xFrednet:0000-rename-good-first-issue-in-docs, r=flip1995

Renamed the good first issue label in CONTRIBUTING.md

Follow up from #6468

Grep found some more references to the old `good first issue`.

[CONTRIBUTING.md rendered](https://github.com/xFrednet/rust-clippy/blob/0000-rename-good-first-issue-in-docs/CONTRIBUTING.md)

<details>
<summary>grep output</summary>

```
$ grep -Ri "good first issue" rust-clippy/
rust-clippy/.git/COMMIT_EDITMSG:Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/HEAD:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2bb8a638a63edc1f3503c8771937aa19157 xFrednet <xFrednet@gmail.com> 1608326295 +0000     commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/HEAD:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f28671ddb9ccf9b44131d522f4fdeab7097 xFrednet <xFrednet@gmail.com> 1608329602 +0000     commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2bb8a638a63edc1f3503c8771937aa19157 xFrednet <xFrednet@gmail.com> 1608326295 +0000  commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f28671ddb9ccf9b44131d522f4fdeab7097 xFrednet <xFrednet@gmail.com> 1608329602 +0000  commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/CONTRIBUTING.md:Some issues are easier than others. The [`good first issue`] label can be used to find the easy issues.
rust-clippy/CONTRIBUTING.md:[`E-medium`] issues are generally pretty easy too, though it's recommended you work on an [`good first issue`]
rust-clippy/CONTRIBUTING.md:[`good first issue`]: https://github.com/rust-lang/rust-clippy/labels/good%20first%20issue
```
</details>

---

changelog: None

r? `@flip1995`

3 years agoRenamed the good first issue label in CONTRIBUTING.md
xFrednet [Fri, 18 Dec 2020 22:13:22 +0000 (22:13 +0000)]
Renamed the good first issue label in CONTRIBUTING.md

3 years agoAuto merge of #6468 - xFrednet:0000-rename-good-first-issue-for-rustbot, r=flip1995
bors [Fri, 18 Dec 2020 21:25:39 +0000 (21:25 +0000)]
Auto merge of #6468 - xFrednet:0000-rename-good-first-issue-for-rustbot, r=flip1995

Renamed the good first issue label for rustbot

The `good first issue` label got renamed to `good-first-issue`. See [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Rename.20the.20.22good.20first.20issue.22.20label.20for.20bot.20usage/near/220428379) to enable the assignment with rustbot.

changelog: None

r? `@flip1995`

3 years agoRenamed the good first issue label for rustbot
xFrednet [Fri, 18 Dec 2020 21:18:15 +0000 (21:18 +0000)]
Renamed the good first issue label for rustbot

See https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Rename.20the.20.22good.20first.20issue.22.20label.20for.20bot.20usage/near/220428018

3 years agoAuto merge of #6465 - Suyash458:master, r=flip1995
bors [Fri, 18 Dec 2020 09:36:05 +0000 (09:36 +0000)]
Auto merge of #6465 - Suyash458:master, r=flip1995

add more lints to msrv docs

Fixes #6097

changelog: None

3 years agoAuto merge of #6458 - ebroto:6022_parse_doctest, r=Manishearth
bors [Fri, 18 Dec 2020 06:57:21 +0000 (06:57 +0000)]
Auto merge of #6458 - ebroto:6022_parse_doctest, r=Manishearth

needless_doctest_main: handle correctly parse errors

Before this change, finding an error when parsing a doctest would make Clippy exit without emitting an error. Now we properly catch a fatal error and ignore it.

Also, if a doctest specifies an edition in the info line, it will be used when parsing it.

changelog: needless_doctest_main: handle correctly parse errors

Fixes #6022

3 years agoadd more lints to msrv docs
Suyash458 [Fri, 18 Dec 2020 05:25:09 +0000 (10:55 +0530)]
add more lints to msrv docs

3 years agomake needless_update ignore non_exhaustive structs
Andrew Houts [Fri, 18 Dec 2020 03:09:55 +0000 (21:09 -0600)]
make needless_update ignore non_exhaustive structs

3 years agoAuto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis
bors [Thu, 17 Dec 2020 18:21:20 +0000 (18:21 +0000)]
Auto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.`

r? `@nikomatsakis`

3 years agoApply suggestion from PR review
Eduardo Broto [Thu, 17 Dec 2020 14:24:44 +0000 (15:24 +0100)]
Apply suggestion from PR review

3 years agoRollup merge of #79051 - LeSeulArtichaut:if-let-guard, r=matthewjasper
Yuki Okushi [Thu, 17 Dec 2020 02:43:55 +0000 (11:43 +0900)]
Rollup merge of #79051 - LeSeulArtichaut:if-let-guard, r=matthewjasper

Implement if-let match guards

Implements rust-lang/rfcs#2294 (tracking issue: #51114).

I probably should do a few more things before this can be merged:
- [x] Add tests (added basic tests, more advanced tests could be done in the future?)
- [x] Add lint for exhaustive if-let guard (comparable to normal if-let statements)
- [x] Fix clippy

However since this is a nightly feature maybe it's fine to land this and do those steps in follow-up PRs.

Thanks a lot `@matthewjasper` :heart: for helping me with lowering to MIR! Would you be interested in reviewing this?
r? `@ghost` for now

3 years agoAuto merge of #6461 - Dorumin:patch-1, r=Manishearth
bors [Thu, 17 Dec 2020 00:22:57 +0000 (00:22 +0000)]
Auto merge of #6461 - Dorumin:patch-1, r=Manishearth

Typo in create_dir doc comment

changelog: none

3 years agoTypo: std::fs::crate_dir -> std::fs::create_dir
Naughty [Wed, 16 Dec 2020 23:48:03 +0000 (20:48 -0300)]
Typo: std::fs::crate_dir -> std::fs::create_dir

3 years agoAuto merge of #6448 - mikerite:interning_defined_symbol, r=Manishearth
bors [Wed, 16 Dec 2020 08:18:38 +0000 (08:18 +0000)]
Auto merge of #6448 - mikerite:interning_defined_symbol, r=Manishearth

New internal lint: Interning defined symbol

New internal lint: interning_defined_symbol

changelog: none

3 years agoRemove unsafe code
Michael Wright [Wed, 16 Dec 2020 04:05:25 +0000 (06:05 +0200)]
Remove unsafe code

3 years agoneedless_doctest_main: add edition support
Eduardo Broto [Tue, 15 Dec 2020 23:14:47 +0000 (00:14 +0100)]
needless_doctest_main: add edition support

3 years agoHandle fatal errors when parsing doctests
Eduardo Broto [Tue, 15 Dec 2020 22:18:03 +0000 (23:18 +0100)]
Handle fatal errors when parsing doctests

3 years agoAuto merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk
bors [Tue, 15 Dec 2020 22:00:02 +0000 (22:00 +0000)]
Auto merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk

make MIR graphviz generation use gsgdt

gsgdt [https://crates.io/crates/gsgdt] is a crate which provides an
interface for stringly typed graphs. It also provides generation of
graphviz dot format from said graph.

This is the first in a series of PRs on moving graphviz code out of rustc into normal crates and then implementating graph diffing on top of these crates.

r? `@oli-obk`

3 years agoConvenience funcs for `some_option.unwrap_or(...)`
Rich Kadel [Mon, 14 Dec 2020 21:12:15 +0000 (13:12 -0800)]
Convenience funcs for `some_option.unwrap_or(...)`

This ensures consistent handling of default values for options that are
None if not specified on the command line.

3 years agoImprove warnings on incompatible options involving -Zinstrument-coverage
Rich Kadel [Mon, 14 Dec 2020 08:25:29 +0000 (00:25 -0800)]
Improve warnings on incompatible options involving -Zinstrument-coverage

Adds checks for:

* `no_core` attribute
* explicitly-enabled `legacy` symbol mangling
* mir_opt_level > 1 (which enables inlining)

I removed code from the `Inline` MIR pass that forcibly disabled
inlining if `-Zinstrument-coverage` was set. The default `mir_opt_level`
does not enable inlining anyway. But if the level is explicitly set and
is greater than 1, I issue a warning.

The new warnings show up in tests, which is much better for diagnosing
potential option conflicts in these cases.

3 years agoAuto merge of #6452 - matthiaskrgr:bump_nightly, r=flip1995
bors [Mon, 14 Dec 2020 17:23:51 +0000 (17:23 +0000)]
Auto merge of #6452 - matthiaskrgr:bump_nightly, r=flip1995

bump pinned nightly from nightly-2020-12-09 to nightly-2020-12-14

This should hopefully fix incremental compilation ICEs in rustc that I have encountered multiple times while working with the previously pinned nightly.

changelog: none

3 years agobump pinned nightly from nightly-2020-12-09 to nightly-2020-12-14
Matthias Krüger [Mon, 14 Dec 2020 16:47:05 +0000 (17:47 +0100)]
bump pinned nightly from nightly-2020-12-09 to nightly-2020-12-14

This should hopefully fix incremental compilation ICEs from rustc that I have been encountering multiple times while working with the previous nightly.

3 years agoAuto merge of #6451 - giraffate:update_contributing_md, r=llogiq
bors [Mon, 14 Dec 2020 06:13:44 +0000 (06:13 +0000)]
Auto merge of #6451 - giraffate:update_contributing_md, r=llogiq

Fix links in CONTRIBUTING.md

Links is broken.

<img width="1219" alt="スクリーンショット 2020-12-14 11 58 19" src="https://user-images.githubusercontent.com/17407489/102035564-fc152400-3e03-11eb-91a7-6c04e120d72f.png">

changelog: none

3 years agoFix links in CONTRIBUTING.md
Takayuki Nakata [Mon, 14 Dec 2020 02:57:35 +0000 (11:57 +0900)]
Fix links in CONTRIBUTING.md

3 years agoAuto merge of #6435 - xFrednet:5552-false-positive-match-single-binding, r=ebroto
bors [Sun, 13 Dec 2020 21:28:38 +0000 (21:28 +0000)]
Auto merge of #6435 - xFrednet:5552-false-positive-match-single-binding, r=ebroto

Fixing a false positive for the `match_single_binding` lint #5552

This is a fix for a false positive in the `match_single_binding` lint when using `#[cfg()]` on a branch. It is sadly a bit hacky but maybe the best solution as rust removes the other branch from the AST before we can even validate it. This fix looks at the code snippet itself and returns if it includes another thick arrow `=>` besides the one matching arm we found. This can again cause false negatives if someone has the following code:
```rust
match x {
    // => <-- Causes a false negative
    _ => 1,
}
```

I thought about making the code more complex and maybe validating against other things like the `#[cfg()]` macro but I believe that this is the best solution. This has basically switched the issue from a false positive to a false negative in a very specific case.

I'm happy to make some changes if you have any suggestions 🙃.

---
Fixes #5552

changelog: Fixed a false positive in the `match_single_binding` lint with `#[cfg()]` macro

3 years agoRemoving false positive for the match_single_binding lint
xFrednet [Wed, 9 Dec 2020 12:25:45 +0000 (12:25 +0000)]
Removing false positive for the match_single_binding lint

* Applying suggested changes from the PR

3 years agoAuto merge of #6450 - matthiaskrgr:dont_format_local_repo, r=ebroto
bors [Sun, 13 Dec 2020 18:07:57 +0000 (18:07 +0000)]
Auto merge of #6450 - matthiaskrgr:dont_format_local_repo, r=ebroto

cargo dev fmt: don't format entire rustc repo if we ran ra_setup previously

It turns out that rustfmt sees a rustc repo that we pulled in as path dependency via `cargo dev ra-setup` as part of the tree and would try to format it :D

Of course we don't want this, so skip formatting if we see that we ran `ra-setup` previously.

changelog: none

3 years agocargo dev: rename ra-setup to ra_setup to be in line with the other commands
Matthias Krüger [Sun, 13 Dec 2020 16:01:44 +0000 (17:01 +0100)]
cargo dev: rename ra-setup to ra_setup to be in line with the other commands

3 years agoclippy dev fmt: don't format if we have a local rustc repo enabled as path dependency...
Matthias Krüger [Sun, 13 Dec 2020 14:49:48 +0000 (15:49 +0100)]
clippy dev fmt: don't format if we have a local rustc repo enabled as path dependency via cargo dev ra-setup.

rustfmt would try to format the entire rustc repo, probably because it sees it as a local dependency.

3 years agoNFC: clippy cargo dev: move generation of clap config into a function
Matthias Krüger [Sun, 13 Dec 2020 14:22:45 +0000 (15:22 +0100)]
NFC: clippy cargo dev: move generation of clap config into a function

3 years agoAuto merge of #6449 - matthiaskrgr:needless_borrow_ty, r=ebroto
bors [Sun, 13 Dec 2020 16:59:02 +0000 (16:59 +0000)]
Auto merge of #6449 - matthiaskrgr:needless_borrow_ty, r=ebroto

needless_borrow: print the type in the lint message

changelog: needless_borrow: print type in lint message

3 years agoAuto merge of #6443 - matthiaskrgr:clone_on_copy_type, r=ebroto
bors [Sun, 13 Dec 2020 16:47:33 +0000 (16:47 +0000)]
Auto merge of #6443 - matthiaskrgr:clone_on_copy_type, r=ebroto

clone_on_copy: show the type in the lint message

changelog: clone_on_copy: show the type in the lint message

3 years agoAuto merge of #6441 - ebroto:use_rustflags, r=flip1995
bors [Sun, 13 Dec 2020 16:37:31 +0000 (16:37 +0000)]
Auto merge of #6441 - ebroto:use_rustflags, r=flip1995

Pass Clippy args also trough RUSTFLAGS

This removes a hack (\_\_CLIPPY_HACKERY\_\_) to add another one :)

It allows this workflow to work:
```terminal
cargo clippy                             # warning: empty `loop {}` wastes CPU cycles
cargo clippy -- -A clippy::empty_loop    # no warnings emitted
```

Before this change the new flag was not taken into consideration in cargo's fingerprint and the warning was emitted again. I guess that ideally we could add a specific env var for compiler wrapper arguments, but in the meantime this should do the job.

changelog: Pass clippy arguments through RUSTFLAGS so that changing them will trigger a rebuild

r? `@flip1995`
cc `@ehuss` (I think this may count as another step towards stabilizing `RUSTC_WORKSPACE_WRAPPER` :smile:)

Fixes #5214 and avoids frustration for users unfamiliar with the issue

3 years agoAddress comments from PR review
Eduardo Broto [Sun, 13 Dec 2020 16:21:53 +0000 (17:21 +0100)]
Address comments from PR review

Also: enable tests for cargo-clippy

3 years agoPass Clippy args also trough RUSTFLAGS
Eduardo Broto [Fri, 11 Dec 2020 22:54:47 +0000 (23:54 +0100)]
Pass Clippy args also trough RUSTFLAGS

3 years agoneedless_borrow: print the type in the lint message
Matthias Krüger [Sun, 13 Dec 2020 14:17:47 +0000 (15:17 +0100)]
needless_borrow: print the type in the lint message

changelog: needless_borrow: print type in lint message

3 years agoAuto merge of #6442 - matthiaskrgr:clone-double-ref-ty, r=llogiq
bors [Sun, 13 Dec 2020 10:09:00 +0000 (10:09 +0000)]
Auto merge of #6442 - matthiaskrgr:clone-double-ref-ty, r=llogiq

clone_double_ref: print reference type in lint message

changelog: clone_double_ref: print the type of the reference in lint message

3 years agoRun 'cargo dev update_lints'
Michael Wright [Sun, 13 Dec 2020 04:46:08 +0000 (06:46 +0200)]
Run 'cargo dev update_lints'

3 years agoFix dogfood errors
Michael Wright [Sun, 13 Dec 2020 04:32:41 +0000 (06:32 +0200)]
Fix dogfood errors

3 years agoNew internal lint: interning_defined_symbol
Michael Wright [Sun, 13 Dec 2020 04:32:41 +0000 (06:32 +0200)]
New internal lint: interning_defined_symbol

3 years agoAuto merge of #6318 - camsteffen:article-description, r=Manishearth
bors [Sat, 12 Dec 2020 21:20:40 +0000 (21:20 +0000)]
Auto merge of #6318 - camsteffen:article-description, r=Manishearth

Use article_and_description for missing docs

Moves closer to the current rustc missing_doc lint

changelog: none

3 years agoAuto merge of #6382 - giraffate:fix_fp_in_manual_range_contains_when_const_fn, r...
bors [Sat, 12 Dec 2020 21:09:20 +0000 (21:09 +0000)]
Auto merge of #6382 - giraffate:fix_fp_in_manual_range_contains_when_const_fn, r=llogiq

Fix FP of `manual_range_contains` in `const fn`

Fix #6373.

changelog: Fix FP of `manual_range_contains` in `const fn`

3 years agoAuto merge of #6413 - phansch:bless, r=flip1995
bors [Sat, 12 Dec 2020 14:42:28 +0000 (14:42 +0000)]
Auto merge of #6413 - phansch:bless, r=flip1995

Rewrite update-all-references bash scripts in Rust

This replaces the `update-all-references` scripts with a single

    cargo dev bless

command. It should behave mostly the same as the bash scripts. The major difference is, that it can be called from the project root and will always update the files in all of the test suites.

cc #5394

changelog: none

3 years agoFeed the dog :dog2:
Philipp Hansch [Sat, 12 Dec 2020 14:14:54 +0000 (15:14 +0100)]
Feed the dog :dog2:

3 years agoImprove variable naming
Philipp Hansch [Thu, 10 Dec 2020 10:34:22 +0000 (11:34 +0100)]
Improve variable naming

3 years agoRewrite update-all-references bash scripts in Rust
Philipp Hansch [Wed, 2 Dec 2020 17:20:02 +0000 (18:20 +0100)]
Rewrite update-all-references bash scripts in Rust

This replaces the `update-all-references` scripts with a single

    cargo dev bless

command.

cc #5394

3 years agoclone_on_copy: show the type in the lint message
Matthias Krüger [Sat, 12 Dec 2020 00:23:28 +0000 (01:23 +0100)]
clone_on_copy: show the type in the lint message

changelog: clone_on_copy: show the type in the lint message

3 years agoclone_double_ref: print reference type in lint message
Matthias Krüger [Sat, 12 Dec 2020 00:09:30 +0000 (01:09 +0100)]
clone_double_ref: print reference type in lint message

changelog: clone_double_ref: print the type of the reference in lint message

3 years agoMove binder for dyn to each list item
Jack Huey [Fri, 11 Dec 2020 20:02:46 +0000 (15:02 -0500)]
Move binder for dyn to each list item