Commit Graph

10794 Commits

Author SHA1 Message Date
Samuel E. Moelius III
5f04b50191 Fix one import 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
ff157ae1f4 Improve tests 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
b7f03c6697 Remove unused features 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
29b6570612 Remove unused dependencies 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
523de296cc Get tests to pass 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
c5b9d22b02 Update clippy_utils/src/lib.rs 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
8d2de8f256 Update clippy_lints/src/lib.rs 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
09bded4437 Factor out clippy_utils crate 2021-02-23 18:50:30 -05:00
bors
a2c25fa9f0 Auto merge of #6573 - Jarcho:option_match_map, r=llogiq
New lint: option_manual_map

fixes: #6
changelog: Added lint: `match_map`
2021-02-23 21:56:25 +00:00
bors
a5c5c8f3b0 Auto merge of #6781 - matthiaskrgr:lintcheck_fix, r=matthiaskrgr
lintcheck fix build (forgot to pass function parameter) and runtime (…

…don't check metadata of directory if it does not exist)

Accidentally broke lintcheck in my previous commit.

changelog: None
2021-02-23 12:05:24 +00:00
Matthias Krüger
eaae95b613 lintcheck fix build (forgot to pass function parameter) and runtime (don't check metadata of directory if it does not exist) 2021-02-23 12:58:12 +01:00
bors
f02df27f04 Auto merge of #6780 - matthiaskrgr:lintcheck2, r=flip1995
lintcheck: fully rerun lintcheck if clippy was rebuilt since last log update

Automatically clean lintchecks shared target dir (will force clippy to recheck sources) if
the clippy binaries are older than the lintcheck logs.

Also updated lintcheck logs in the pr.

changelog: lintcheck: fully rerun lintcheck if clippy was rebuilt since last log update
2021-02-23 08:31:28 +00:00
Matthias Krüger
363f6d3dc6 lintcheck: rerun if clippy changed
Automatically clean lintchecks shared target dir (will force clippy to recheck sources) if
the clippy binaries are older than the lintcheck logs.

Also update lintcheck logs
2021-02-23 08:32:50 +01:00
bors
0984754dd7 Auto merge of #6777 - giraffate:remove_unneeded_blank_lines_from_doc, r=phansch
Remove unneeded blank lines from doc

Remove unneeded blank lines like below.
<img width="1142" alt="スクリーンショット 2021-02-22 23 01 17" src="https://user-images.githubusercontent.com/17407489/108719295-bb9ff800-7562-11eb-9338-8f2571e61c56.png">

changelog: none
2021-02-23 06:05:27 +00:00
bors
a3127fafb4 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.

changelog: none
2021-02-23 05:53:59 +00:00
Takayuki Nakata
e05965eb13 Remove unneeded blank lines from doc 2021-02-22 23:02:04 +09:00
bors
697f3b6d4f 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.
2021-02-22 11:40:20 +00:00
Matthias Krüger
0eefa6169d 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.
2021-02-22 12:30:28 +01:00
bors
fe01ddc8bc 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.

changelog: Add style lint: `inconsistent_struct_constructor`
2021-02-22 09:29:20 +00:00
Jason Newcomb
23aa2f880c
Fix dogfood errors 2021-02-21 23:15:28 -05:00
Yoshitomo Nakanishi
5fe3b6c41a Quick fix cargo dev bless 2021-02-22 12:45:11 +09:00
Jason Newcomb
efe33f9fe4
Add: option_manual_map lint 2021-02-21 22:06:03 -05:00
Yoshitomo Nakanishi
bfdf0fa03f Describe the order of fields in struct ctor doesn't affect the resulted instance 2021-02-22 11:45:25 +09:00
bors
728f3976f0 Auto merge of #6771 - MortenLohne:master, r=flip1995
Fix FP in inherent_to_string when the function has generic parameters

Minimal example of the false positive:
````
struct G;

impl G {
    fn to_string<const _N: usize>(&self) -> String {
        "G.to_string()".to_string()
    }
}

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.

changelog: Fix FP in `inherent_to_string`
2021-02-21 16:10:03 +00:00
bors
208e95781b Auto merge of #6770 - ThibsG:PostfixEnumVariant, r=flip1995
Fix camel case postfix for `enum_variant_names` lint

Fix camel case postfix

Fixes: #4639

changelog: none
2021-02-21 15:58:47 +00:00
bors
8a47901bac 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.

Closes #6726
2021-02-21 15:33:50 +00:00
bors
d2ddf9c796 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
2021-02-21 15:22:35 +00:00
Morten Lohne
19a377510c Fix FP in inherent_to_string when the function has generic parameters 2021-02-21 00:11:17 +01:00
Yoshitomo Nakanishi
d646aa2ae7 Fix unnecessary_sort_by.rs that fails the dogfood test 2021-02-21 05:05:13 +09:00
Yoshitomo Nakanishi
d23038944a New lint: inconsistent_struct_constructor 2021-02-21 05:05:11 +09:00
ThibsG
5af6f96c8f Fix camel case postfix for enum_variant_names lint 2021-02-20 19:48:04 +01:00
bors
67087a1b4e Auto merge of #6717 - booleancoercion:master, r=llogiq
Add the from_str_radix_10 lint

changelog: added the new `from_str_radix_10` which sometimes replaces calls to `primitive::from_str_radix` to `str::parse`

This is ready to be merged, although maybe the category should be `pedantic` instead of `style`? I'm not sure where it fits better.

Closes #6713.
2021-02-20 09:33:11 +00:00
bors
2746632917 Auto merge of #6766 - matthiaskrgr:nestedmatch, r=flip1995
collapsible_match: fix lint message capitalization

(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
2021-02-20 00:36:53 +00:00
bors
23de8013a6 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
2021-02-20 00:25:10 +00:00
Matthias Krüger
8499a32859 lintcheck: add -j <N> option to configure threads.
defaults to 1
-j 0 choses the number of threads automtically (= number of physical cores)
2021-02-19 23:20:05 +01:00
Matthias Krüger
22aeec09e4 lintcheck: sort crates before linting 2021-02-19 22:16:53 +01:00
Matthias Krüger
4974734a24 lintcheck: show progress percentage in the "Linting..." message 2021-02-19 22:06:50 +01:00
Matthias Krüger
d198551311 lintheck: show output (and compiler errors!) when compiling clippy for lintcheck 2021-02-19 21:52:34 +01:00
Matthias Krüger
bb5f9d18a0 lintcheck: tweak some comments 2021-02-19 21:48:52 +01:00
bool
c4b8d87ab9 Fixed the known problems section 2021-02-19 22:00:23 +02:00
bool
bf55aee7b1 Updated from_str_radix_10 sugg to be slightly smarter and ran bless 2021-02-19 21:56:21 +02:00
Matthias Krüger
1f4153aa1e collapsible_match: fix lint message capitalization
(see https://rustc-dev-guide.rust-lang.org/diagnostics.html for details)
2021-02-19 10:02:17 +01:00
Cameron Steffen
46c91db1e1 Change known problems 2021-02-18 20:23:49 -06:00
Cameron Steffen
54c6054ec7 Change unnecessary_wraps to pedantic 2021-02-18 20:03:13 -06:00
Matthias Krüger
90d3275b45 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).
2021-02-19 00:14:43 +01:00
bors
0f70e88137 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
2021-02-18 22:47:44 +00:00
Pierre-Andre Gagnon
a78271b861 Changed fn body suggestion msg 2021-02-18 17:32:55 -05:00
bors
2f815ecd00 Auto merge of #6763 - flip1995:fix_lintcheck, r=matthiaskrgr
Fix lintcheck by excluding checked crates from workspace

r? `@matthiaskrgr`  cc `@camsteffen`

So `exclude` doesn't work with glob patterns, but it turns out that it works with `starts_with`.

changelog: none
2021-02-18 22:15:42 +00:00
flip1995
aea55d2c62
Fix lintcheck by excluding checked crates from workspace 2021-02-18 23:07:19 +01:00
bors
7d535f6a91 Auto merge of #6759 - Y-Nak:fix-fp-of-result_unit_err, r=llogiq
Fix FP of result_unit_err when using type aliases

fixes #6546

changelog: none
2021-02-18 21:39:29 +00:00