bors [Tue, 23 Feb 2021 05:53:59 +0000 (05:53 +0000)]
Auto merge of #6774 - Y-Nak:quick-fix-bless, r=phansch
Quick fix cargo dev bless
fixes #6757
r? `@phansch`
Trying to do a quick fix of `bless`, I'm not sure how much work it will need to do transition to `bless` built in `compiletest`, so please feel free to close this PR if it will not need so much.
bors [Mon, 22 Feb 2021 11:40:20 +0000 (11:40 +0000)]
Auto merge of #6775 - matthiaskrgr:upper_case_pedantic, r=flip1995
upper_case_acronyms: move lint from style to pedantic lint group
The lint does point out inconsistency with the Rust naming convention,
but the fact that rustc does not warn about the inconsistency by default
means that clippy probably should not warn by default either.
changelog: move upper_case_acronyms lint from style to pedantic group.
Matthias Krüger [Mon, 22 Feb 2021 11:30:28 +0000 (12:30 +0100)]
upper_case_acronyms: move lint from style to pedantic lint group
The lint does point out inconsistency with the Rust naming convention,
but the fact that rustc does not warn about the inconsistency by default
means that clippy probably should not warn by default either.
changelog: move upper_case_acronyms lint from style to pedantic group.
bors [Mon, 22 Feb 2021 09:29:20 +0000 (09:29 +0000)]
Auto merge of #6769 - Y-Nak:inconsistent-struct-constructor, r=matthiaskrgr
Inconsistent struct constructor
fixes: #6352
r? `@matthiaskrgr`
I added the lint that checks for the struct constructors where the order of the field init shorthands is inconsistent with that in the struct definition.
fn main() {
let g = G;
g.to_string::<1>();
}
````
Clippy emits an `inherent_to_string` warning, and suggests that we implement `Display` for `G` instead. However, this is not possible, since the generic parameter _N only exists in this function, not in `G` itself. This particular example uses const generics, which is where the issue is most likely to come up, but this PR skips the lint if the `to_string` function has any kind of generic parameters.
bors [Sun, 21 Feb 2021 15:33:50 +0000 (15:33 +0000)]
Auto merge of #6765 - camsteffen:unnecessary-wraps-pedantic, r=flip1995
Change unnecessary_wraps to pedantic
changelog: Change unnecessary_wraps to pedantic
There seems to be enough evidence that this lint is not wanted as warn-by-default. Attempted before at #6380. False positives at #6721 and #6427. Actually requested to change the category at #6726.
bors [Sun, 21 Feb 2021 15:22:35 +0000 (15:22 +0000)]
Auto merge of #6754 - camsteffen:spanlesseq-res, r=flip1995
Teach SpanlessEq binding IDs
changelog: Fix collapsible_match false positive
Fixes #6740
This PR changes the way `SpanlessEq` determines whether two local variables are the same. Instead of checking that the names match, it checks that the `HirId`s match. If local bindings are declared within the expressions that are being compared, `SpanlessEq` will remember bindings that correspond to each other in a `FxHashMap<HirId, HirId>`. This makes `SpanlessEq` more flexible while also fixing false positives.
Example: `{ let x = 1; x + 2 }` is equal to `{ let y = 1; y + 2 }`.
CC `@xFrednet` I think this will resolve some concerns in #6463
(see https://rustc-dev-guide.rust-lang.org/diagnostics.html for details)
---
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: collapsible_match: fix lint message capitalization
bors [Sat, 20 Feb 2021 00:25:10 +0000 (00:25 +0000)]
Auto merge of #6764 - matthiaskrgr:lintcheck_par_iter, r=flip1995
lintcheck: parallelize
By default we use a single thread and one target dir as before.
If `-j n` is passed, use `n` target dirs and run one clippy in each of them.
We need several target dirs because cargo would lock them for a single process otherwise which would prevent the parallelism.
`-j 0` makes rayon use $thread_count/2 (which I assume is the number of physical cores of a machine) for the number of threads.
Other change:
Show output of clippy being compiled when building it for lintcheck (makes it easier to spot compiler errors etc)
Show some progress indication in the "Linting... foo 1.2.3" message.
Sort crates before linting (previously crates would be split randomly between target dirs, with the sorting, we try to make sure that even crates land in target dir 0 and odd ones in target dir 1 etc..)
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: parallelize lintcheck with rayon
Matthias Krüger [Thu, 18 Feb 2021 18:09:12 +0000 (19:09 +0100)]
lintcheck: parallelize
Use rayon to figure out the threadcount and half that for core count.
For each core, create a target dir that is used.
Otherwise, when running multiple clippys with the same target-dir, cargo would lock the dir and prevent parallelism.
This way we can run multiple clippys at the same time (on root crates) but we sacrifice cache-hits (when we already cargo-checked crate-deps).
bors [Thu, 18 Feb 2021 22:47:44 +0000 (22:47 +0000)]
Auto merge of #6665 - pag4k:unnecessary_wraps_bug_6640, r=camsteffen
Fix for issue 6640
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: unnecessary_wraps will now suggest to remove unnecessary wrapped return unit type, like Option<()>
fixes #6640
bors [Wed, 17 Feb 2021 12:53:31 +0000 (12:53 +0000)]
Auto merge of #6750 - flip1995:lintcheck_options, r=matthiaskrgr
Lintcheck and an options for command line options
Make it possible to add command line options to the clippy invocation of the lintcheck-tool
changelog: none
r? `@matthiaskrgr`
I found that this will be really helpful if we use a separate repository and want to maintain a all-lints-passing list of crates. See my early experimentation here: https://github.com/flip1995/clippy-lintcheck
```
git submodule update --init
cargo run -- --mode=all
```
Will run the lintcheck tool on all the specified crates in `config/` in that repository.
bors [Tue, 16 Feb 2021 09:58:49 +0000 (09:58 +0000)]
Auto merge of #6662 - Y-Nak:default-numeric-fallback, r=flip1995
New lint: default_numeric_fallback
fixes #6064
r? `@flip1995`
As we discussed in [here](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20.236064/near/224647188) and [here](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20clippy.236064/near/224746333), I start implementing this lint from the strictest version.
In this PR, I'll allow the below two cases to pass the lint to reduce FPs.
1. Appearances of unsuffixed numeric literals in `Local` if `Local` has a type annotation, for example:
```rust
// Good.
let x: i32 = 1;
// Also good.
let x: (i32, i32) = if cond {
(1, 2)
} else {
(2, 3)
};
```
2. Appearances of unsuffixed numeric literals in args of `Call` or `MethodCall` if corresponding arguments of their signature have concrete types, for example:
```rust
fn foo_mono(x: i32) -> i32 {
x
}
bors [Tue, 16 Feb 2021 08:20:17 +0000 (08:20 +0000)]
Auto merge of #6744 - matthiaskrgr:lintcheck, r=flip1995
more lintcheck updates
* do some refactoring and renaming here and there
* add comments to functions
* fix bug where git repos would not get checked out to the proper commits (cmd was not actually run in repo directory :sweat_smile: )
* print warnings if we can't clone or check out a git repo
* filter out noise from cargo-metadata errors and lint messages that contained absolute file paths (these would change with every pinned-nightly bump, polluting the logs)
changelog: more lintcheck refactoring and fixes for git crates
bors [Sat, 13 Feb 2021 16:03:07 +0000 (16:03 +0000)]
Auto merge of #6735 - matthiaskrgr:lintcheck, r=flip1995
lintcheck: accept env var to set crates.toml file
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: lintcheck: accept LINTCHECK_TOML env var to set list of crates to be checked.
bors [Sat, 13 Feb 2021 15:51:14 +0000 (15:51 +0000)]
Auto merge of #6738 - xFrednet:0000-update-labels-in-template-files, r=flip1995
Update labels in template files
It seems like we forgot to update the GitHub templates when we decided to update the label names. This PR just adjusts the templates to use the new label names :)
Context: [Zulip discussion about renaming the labels](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Label.20cleanup/near/224083870)
bors [Fri, 12 Feb 2021 20:48:05 +0000 (20:48 +0000)]
Auto merge of #6700 - daxpedda:panics-doc-unreachable, r=llogiq
Fix missing_panics_doc warning on `unreachable!`.
Fixes #6699.
Are there any other test-cases I should cover?
changelog: [`missing_panics_doc`](https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc): No longer lints on [`unreachable!`](https://doc.rust-lang.org/std/macro.unreachable.html)