]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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

3 years agoAuto merge of #6401 - ebroto:pin_to_a_nightly, r=ebroto
bors [Fri, 11 Dec 2020 16:25:13 +0000 (16:25 +0000)]
Auto merge of #6401 - ebroto:pin_to_a_nightly, r=ebroto

📌 Pin Clippy to a nightly 📌

changelog: Pin Clippy to a specific nightly version (No more master/custom toolchain required to compile Clippy)

Addresses partially #5561. As proposed there in [this comment](https://github.com/rust-lang/rust-clippy/issues/5561#issuecomment-623109095), this kicks off the process, to help us get acquainted with how the syncs should work, before working on improving the tooling.

Open questions:
* When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that.
* When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful.
* Who does the rustups now? If we follow my previous idea and do both rustup and clippyup at the same time, it would be more work for `@flip1995` who currently does the clippyups. I would prefer to establish some kind of rotation to spead the work. Other ideas?
* I'm not sure if this affects the release process in any way.
* ???

`@rust-lang/clippy` thoughts?

r? `@flip1995`

3 years agoFix FP of `manual_range_contains` in `const fn`
Takayuki Nakata [Wed, 25 Nov 2020 08:07:50 +0000 (17:07 +0900)]
Fix FP of `manual_range_contains` in `const fn`

3 years agoAuto merge of #6424 - Suyash458:master, r=flip1995
bors [Fri, 11 Dec 2020 08:38:19 +0000 (08:38 +0000)]
Auto merge of #6424 - Suyash458:master, r=flip1995

Add MSRV to more lints specified in #6097

add MSRV to more lints specified in #6097
add instructions for adding msrv in other lints
update tests

 - [x] `redundant_field_names` requires Rust 1.17 due to suggest feature stablized in that version.
 - [x] `redundant_static_lifetimes` requires Rust 1.17 due to suggest feature stablized in that version.
 - [x] `filter_map_next` requires Rust 1.30 due to suggest `Iterator::find_map`.
 - [x] `checked_conversions` requires Rust 1.34 due to suggest `TryFrom`.
 - [x] `match_like_matches_macro` requires Rust 1.42 due to suggest `matches!`. Addressed in #6201
 - [x] `manual_strip` requires Rust 1.45 due to suggest `str::{strip_prefix, strip_suffix}`. Addressed in #6201
 - [x] `option_as_ref_deref` requires Rust 1.40 due to suggest `Option::{as_deref, as_deref_mut}`. Addressed in #6201
 - [x] `manual_non_exhaustive` requires Rust 1.40 due to suggest `#[non_exhaustive]`. Addressed in #6201
 - [x] `manual_range_contains` requires Rust 1.35 due to suggest `Range*::contains`.
 - [x] `use_self` requires Rust 1.37 due to suggest `Self::Variant on enum`.
 - [x] `mem_replace_with_default` requires Rust 1.40 due to suggest `mem::take`.
 - [x] `map_unwrap_or` requires Rust 1.41 due to suggest `Result::{map_or, map_or_else}`.
 - [x] `missing_const_for_fn` requires Rust 1.46 due to `match/if/loop in const fn` needs that version.

changelog: Add MSRV config to more lints. ^This is now the complete list, AFAWK

3 years agoadd test for missing_const_for_fn. fix test stderr
Suyash458 [Wed, 9 Dec 2020 11:09:33 +0000 (16:39 +0530)]
add test for missing_const_for_fn. fix test stderr

3 years agoadd instructions to include msrv in lints
Suyash458 [Tue, 8 Dec 2020 16:55:20 +0000 (22:25 +0530)]
add instructions to include msrv in lints

3 years agoadd MSRV to more lints specified in #6097
suyash458 [Sat, 5 Dec 2020 12:59:22 +0000 (04:59 -0800)]
add MSRV to more lints specified in #6097
update tests

3 years agoAdd tests for unsized trait in `wrong_self_convention` lint
ThibsG [Thu, 10 Dec 2020 16:00:55 +0000 (17:00 +0100)]
Add tests for unsized trait in `wrong_self_convention` lint

3 years agoUpdate tests/ui/use_self.rs
Thibaud [Tue, 24 Nov 2020 17:04:58 +0000 (18:04 +0100)]
Update tests/ui/use_self.rs

Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
3 years agoAllow `wrong_self_convention` in `use_self` test for trait def
ThibsG [Tue, 10 Nov 2020 11:26:09 +0000 (12:26 +0100)]
Allow `wrong_self_convention` in `use_self` test for trait def

3 years agoCommon function to lint wrong self convention from impl and trait def
ThibsG [Tue, 10 Nov 2020 07:56:17 +0000 (08:56 +0100)]
Common function to lint wrong self convention from impl and trait def

3 years agoLint wrong self convention in trait also
ThibsG [Mon, 9 Nov 2020 22:38:08 +0000 (23:38 +0100)]
Lint wrong self convention in trait also

3 years agoFix integration test runner
flip1995 [Thu, 10 Dec 2020 10:00:05 +0000 (11:00 +0100)]
Fix integration test runner

3 years agoError in integration test, if required toolchain is not installed
flip1995 [Thu, 10 Dec 2020 09:44:33 +0000 (10:44 +0100)]
Error in integration test, if required toolchain is not installed

3 years agoStop caching on CI
flip1995 [Thu, 10 Dec 2020 08:36:19 +0000 (09:36 +0100)]
Stop caching on CI

The only thing we now cache is cargo-cache, which we only use for cache.
That's a catch-22 if I ever seen one. And for Clippy itself we always
want to do a clean build and not cache anything.

3 years agoFix toolchain installation in workflows
flip1995 [Thu, 10 Dec 2020 07:53:27 +0000 (08:53 +0100)]
Fix toolchain installation in workflows

3 years agoEnable internal lints for every test in CI
flip1995 [Thu, 10 Dec 2020 07:51:27 +0000 (08:51 +0100)]
Enable internal lints for every test in CI

3 years agoUse new cache key
Eduardo Broto [Wed, 9 Dec 2020 22:38:15 +0000 (23:38 +0100)]
Use new cache key

3 years agoApply suggestions from PR review
Eduardo Broto [Wed, 9 Dec 2020 16:20:38 +0000 (17:20 +0100)]
Apply suggestions from PR review

Also:
  - Update to latest nightly

3 years agoPin Clippy to a nightly
Eduardo Broto [Sun, 29 Nov 2020 17:08:47 +0000 (18:08 +0100)]
Pin Clippy to a nightly

3 years agoAuto merge of #6218 - korrat:master, r=ebroto
bors [Wed, 9 Dec 2020 17:08:00 +0000 (17:08 +0000)]
Auto merge of #6218 - korrat:master, r=ebroto

Add lint for maps with zero-sized value types

Hi, this is my first time contributing to clippy or rust in general, so I'm not sure about the details of contributing. Please excuse me and let me now if I did anything wrong. I have a couple of questions:

1. I'm not sure what category this lint should be. I've put it in "nursery" for now.
1. Should I squash commits this is reviewed/merged?

changelog: Add lint for maps with zero-sized value types

Fixes #1641

3 years agoAdd a lint for maps with zero-sized values
Korrat [Sat, 24 Oct 2020 14:48:10 +0000 (16:48 +0200)]
Add a lint for maps with zero-sized values

Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
3 years agoAuto merge of #6188 - ebroto:primary_package, r=flip1995
bors [Wed, 9 Dec 2020 15:37:20 +0000 (15:37 +0000)]
Auto merge of #6188 - ebroto:primary_package, r=flip1995

Add --no-deps option to avoid running on path dependencies in workspaces

Since rust-lang/cargo#8758 has hit nightly, this allows us to address the second bullet point and [the concern related to `--fix`](https://github.com/rust-lang/cargo/issues/8143#issuecomment-619289546) in the [RUSTC_WORKSPACE_WRAPPER tracking issue](https://github.com/rust-lang/cargo/issues/8143).

As a reminder stabilizing that env var will solve #4612 (Clippy not running after `cargo check` in stable) and would allow to stabilize the `--fix` option in Clippy.

changelog: Add `--no-deps` option to avoid running on path dependencies in workspaces

Fixes #3025

3 years agoAuto merge of #6367 - justjosias:6348-print-stderr, r=ebroto
bors [Tue, 8 Dec 2020 22:22:49 +0000 (22:22 +0000)]
Auto merge of #6367 - justjosias:6348-print-stderr, r=ebroto

Add lint print_stderr

Resolves #6348
Almost identical to print_stdout, this lint applies to the `eprintln!` and `eprint!` macros rather than `println!` and `print!`.

changelog: Add new lint [`print_stderr`]. [`println_empty_string`] and [`print_with_newline`] now apply to `eprint!()` and `eprintln!()` respectively.

3 years agoFactor out some code in write.rs
Eduardo Broto [Tue, 8 Dec 2020 22:17:12 +0000 (23:17 +0100)]
Factor out some code in write.rs

Get rid of the too-many-lines error.

3 years agoAuto merge of #6432 - giraffate:sync-from-rust, r=flip1995
bors [Tue, 8 Dec 2020 08:11:41 +0000 (08:11 +0000)]
Auto merge of #6432 - giraffate:sync-from-rust, r=flip1995

Rustup

changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into sync-from-rust
Takayuki Nakata [Tue, 8 Dec 2020 08:01:25 +0000 (17:01 +0900)]
Merge remote-tracking branch 'upstream/master' into sync-from-rust

3 years agoAuto merge of #6330 - camsteffen:redundant-else, r=ebroto
bors [Tue, 8 Dec 2020 00:51:51 +0000 (00:51 +0000)]
Auto merge of #6330 - camsteffen:redundant-else, r=ebroto

Add Redundant else lint

changelog: Add redundant_else lint

It seemed appropriate for "pedantic".

Closes #112 \*blows off dust*

3 years agoAuto merge of #6280 - dp304:assert_in_result_fn, r=ebroto
bors [Mon, 7 Dec 2020 23:16:05 +0000 (23:16 +0000)]
Auto merge of #6280 - dp304:assert_in_result_fn, r=ebroto

Add lint for assertions in functions returning Result

changelog: none
fixes #6082

3 years agoUpdate reference file
Eduardo Broto [Mon, 7 Dec 2020 23:14:05 +0000 (00:14 +0100)]
Update reference file

3 years agoApply suggestions from code review
dp304 [Thu, 3 Dec 2020 22:07:24 +0000 (23:07 +0100)]
Apply suggestions from code review

Use array slice instead of `Vec` in `find_macro_calls` as suggested by @ebroto

Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
3 years agopanic_in_result_fn: Extend to also check usages of [debug_]assert* macros
Dobe Peter [Sat, 31 Oct 2020 19:31:34 +0000 (20:31 +0100)]
panic_in_result_fn: Extend to also check usages of [debug_]assert* macros

Also, the macro-finding logic has been moved to the util module, for
use by future lints.

3 years agoAdd eprint! to print_with_newline lint
Josias [Fri, 4 Dec 2020 14:39:09 +0000 (15:39 +0100)]
Add eprint! to print_with_newline lint

3 years agoFix print_stderr.stderr test
Josias [Tue, 1 Dec 2020 10:29:49 +0000 (11:29 +0100)]
Fix print_stderr.stderr test