Commit Graph

10429 Commits

Author SHA1 Message Date
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
bors
0904f5475a 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
2020-12-19 13:58:22 +00:00
Philipp Hansch
8ddf4ce87a
UI Tests: Separate suspicious_else_formatting tests 2020-12-19 13:54:38 +01:00
bors
73feb31bc3 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
2020-12-19 12:28:00 +00:00
Jack Huey
f00b6ac24e More rebinds 2020-12-19 04:26:35 -05:00
Philipp Hansch
dfb4ea588c
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.
2020-12-19 08:43:45 +01:00
bors
0718eeb648 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
2020-12-19 07:35:04 +00:00
Andrew Houts
a24c6f14fa remove example 2020-12-18 19:15:05 -06:00
bors
a898df4fa7 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 1f58c2bb8a xFrednet <xFrednet@gmail.com> 1608326295 +0000     commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/HEAD:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f2867 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 1f58c2bb8a 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 ced54f2867 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`
2020-12-18 22:40:08 +00:00
xFrednet
ced54f2867 Renamed the good first issue label in CONTRIBUTING.md 2020-12-18 22:13:22 +00:00
bors
9be704584f 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`
2020-12-18 21:25:39 +00:00
xFrednet
1f58c2bb8a 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
2020-12-18 21:18:15 +00:00
bors
896d82f7ff Auto merge of #6465 - Suyash458:master, r=flip1995
add more lints to msrv docs

Fixes #6097

changelog: None
2020-12-18 09:36:05 +00:00
bors
88323e856d 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
2020-12-18 06:57:21 +00:00
Suyash458
920c9a4aae add more lints to msrv docs 2020-12-18 10:55:09 +05:30
Andrew Houts
1eb7608a2e make needless_update ignore non_exhaustive structs 2020-12-17 21:28:16 -06:00
flip1995
c06793bbe7
Add Roadmap for 2021 2020-12-17 21:44:40 +01:00
bors
8e9a538ae1 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`
2020-12-17 18:21:20 +00:00
Eduardo Broto
bb68ec6cfc Apply suggestion from PR review 2020-12-17 15:28:05 +01:00
Yuki Okushi
286e492343 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` ❤️ for helping me with lowering to MIR! Would you be interested in reviewing this?
r? `@ghost` for now
2020-12-17 11:43:55 +09:00
bors
5c00931642 Auto merge of #6461 - Dorumin:patch-1, r=Manishearth
Typo in create_dir doc comment

changelog: none
2020-12-17 00:22:57 +00:00
Naughty
1d6fac6167
Typo: std::fs::crate_dir -> std::fs::create_dir 2020-12-16 20:48:03 -03:00
bors
142f0f5eda Auto merge of #6448 - mikerite:interning_defined_symbol, r=Manishearth
New internal lint: Interning defined symbol

New internal lint: interning_defined_symbol

changelog: none
2020-12-16 08:18:38 +00:00
Michael Wright
f732cc5cd6 Remove unsafe code 2020-12-16 06:05:25 +02:00
Eduardo Broto
41b5ebebfd needless_doctest_main: add edition support 2020-12-16 00:14:47 +01:00
Eduardo Broto
39bcf8e554 Handle fatal errors when parsing doctests 2020-12-15 23:18:03 +01:00
bors
39aca5ff9f 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`
2020-12-15 22:00:02 +00:00
Rich Kadel
ae288df51f 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.
2020-12-14 17:27:27 -08:00
Rich Kadel
3043a7b5d9 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.
2020-12-14 12:55:46 -08:00
bors
6c83e5684d 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
2020-12-14 17:23:51 +00:00
Matthias Krüger
8b1e9ed85b 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.
2020-12-14 17:47:05 +01:00
bors
5b038341fb 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
2020-12-14 06:13:44 +00:00
Takayuki Nakata
426aba2ef4 Fix links in CONTRIBUTING.md 2020-12-14 11:57:35 +09:00