]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #6782 - ojeda:readme-as-wrapper, r=flip1995
bors [Wed, 24 Feb 2021 09:31:26 +0000 (09:31 +0000)]
Auto merge of #6782 - ojeda:readme-as-wrapper, r=flip1995

README: Add subsection on running Clippy as a rustc wrapper

This is useful for projects that do not use cargo.

changelog: README: Add subsection on running Clippy as a rustc wrapper

3 years agoREADME: Add subsection on running Clippy as a rustc wrapper
Miguel Ojeda [Tue, 23 Feb 2021 14:54:40 +0000 (15:54 +0100)]
README: Add subsection on running Clippy as a rustc wrapper

This is useful for projects that do not use cargo.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
3 years agoAuto merge of #6573 - Jarcho:option_match_map, r=llogiq
bors [Tue, 23 Feb 2021 21:56:25 +0000 (21:56 +0000)]
Auto merge of #6573 - Jarcho:option_match_map, r=llogiq

New lint: option_manual_map

fixes: #6
changelog: Added lint: `match_map`

3 years agoAuto merge of #6781 - matthiaskrgr:lintcheck_fix, r=matthiaskrgr
bors [Tue, 23 Feb 2021 12:05:24 +0000 (12:05 +0000)]
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

3 years agolintcheck fix build (forgot to pass function parameter) and runtime (don't check...
Matthias Krüger [Tue, 23 Feb 2021 11:58:12 +0000 (12:58 +0100)]
lintcheck fix build (forgot to pass function parameter) and runtime (don't check metadata of directory if it does not exist)

3 years agoAuto merge of #6780 - matthiaskrgr:lintcheck2, r=flip1995
bors [Tue, 23 Feb 2021 08:31:28 +0000 (08:31 +0000)]
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

3 years agolintcheck: rerun if clippy changed
Matthias Krüger [Mon, 22 Feb 2021 23:40:50 +0000 (00:40 +0100)]
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

3 years agoAuto merge of #6777 - giraffate:remove_unneeded_blank_lines_from_doc, r=phansch
bors [Tue, 23 Feb 2021 06:05:27 +0000 (06:05 +0000)]
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

3 years agoAuto merge of #6774 - Y-Nak:quick-fix-bless, r=phansch
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.

changelog: none

3 years agoRemove unneeded blank lines from doc
Takayuki Nakata [Mon, 22 Feb 2021 14:02:04 +0000 (23:02 +0900)]
Remove unneeded blank lines from doc

3 years agoAuto merge of #6775 - matthiaskrgr:upper_case_pedantic, r=flip1995
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.

3 years agoupper_case_acronyms: move lint from style to pedantic lint 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.

3 years agoAuto merge of #6769 - Y-Nak:inconsistent-struct-constructor, r=matthiaskrgr
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.

changelog: Add style lint: `inconsistent_struct_constructor`

3 years agoFix dogfood errors
Jason Newcomb [Fri, 19 Feb 2021 19:04:37 +0000 (14:04 -0500)]
Fix dogfood errors

3 years agoQuick fix cargo dev bless
Yoshitomo Nakanishi [Mon, 22 Feb 2021 03:32:41 +0000 (12:32 +0900)]
Quick fix cargo dev bless

3 years agoAdd: option_manual_map lint
Jason Newcomb [Sun, 10 Jan 2021 14:46:03 +0000 (09:46 -0500)]
Add: option_manual_map lint

3 years agoDescribe the order of fields in struct ctor doesn't affect the resulted instance
Yoshitomo Nakanishi [Mon, 22 Feb 2021 02:45:25 +0000 (11:45 +0900)]
Describe the order of fields in struct ctor doesn't affect the resulted instance

3 years agoAuto merge of #6771 - MortenLohne:master, r=flip1995
bors [Sun, 21 Feb 2021 16:10:03 +0000 (16:10 +0000)]
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`

3 years agoAuto merge of #6770 - ThibsG:PostfixEnumVariant, r=flip1995
bors [Sun, 21 Feb 2021 15:58:47 +0000 (15:58 +0000)]
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

3 years agoAuto merge of #6765 - camsteffen:unnecessary-wraps-pedantic, r=flip1995
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.

Closes #6726

3 years agoAuto merge of #6754 - camsteffen:spanlesseq-res, r=flip1995
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

3 years agoFix FP in inherent_to_string when the function has generic parameters
Morten Lohne [Sat, 20 Feb 2021 22:47:49 +0000 (23:47 +0100)]
Fix FP in inherent_to_string when the function has generic parameters

3 years agoFix unnecessary_sort_by.rs that fails the dogfood test
Yoshitomo Nakanishi [Sat, 20 Feb 2021 14:02:18 +0000 (23:02 +0900)]
Fix unnecessary_sort_by.rs that fails the dogfood test

3 years agoNew lint: inconsistent_struct_constructor
Yoshitomo Nakanishi [Sat, 20 Feb 2021 13:52:56 +0000 (22:52 +0900)]
New lint: inconsistent_struct_constructor

3 years agoFix camel case postfix for `enum_variant_names` lint
ThibsG [Sat, 20 Feb 2021 18:48:04 +0000 (19:48 +0100)]
Fix camel case postfix for `enum_variant_names` lint

3 years agoAuto merge of #6717 - booleancoercion:master, r=llogiq
bors [Sat, 20 Feb 2021 09:33:11 +0000 (09:33 +0000)]
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.

3 years agoAuto merge of #6766 - matthiaskrgr:nestedmatch, r=flip1995
bors [Sat, 20 Feb 2021 00:36:53 +0000 (00:36 +0000)]
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

3 years agoAuto merge of #6764 - matthiaskrgr:lintcheck_par_iter, r=flip1995
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

3 years agolintcheck: add -j <N> option to configure threads.
Matthias Krüger [Fri, 19 Feb 2021 22:20:05 +0000 (23:20 +0100)]
lintcheck: add -j <N> option to configure threads.

defaults to 1
-j 0 choses the number of threads automtically (= number of physical cores)

3 years agolintcheck: sort crates before linting
Matthias Krüger [Fri, 19 Feb 2021 21:16:53 +0000 (22:16 +0100)]
lintcheck: sort crates before linting

3 years agolintcheck: show progress percentage in the "Linting..." message
Matthias Krüger [Fri, 19 Feb 2021 21:06:50 +0000 (22:06 +0100)]
lintcheck: show progress percentage in the "Linting..." message

3 years agolintheck: show output (and compiler errors!) when compiling clippy for lintcheck
Matthias Krüger [Fri, 19 Feb 2021 20:52:34 +0000 (21:52 +0100)]
lintheck: show output (and compiler errors!) when compiling clippy for lintcheck

3 years agolintcheck: tweak some comments
Matthias Krüger [Fri, 19 Feb 2021 20:48:52 +0000 (21:48 +0100)]
lintcheck: tweak some comments

3 years agoFixed the known problems section
bool [Fri, 19 Feb 2021 20:00:23 +0000 (22:00 +0200)]
Fixed the known problems section

3 years agoUpdated from_str_radix_10 sugg to be slightly smarter and ran bless
bool [Fri, 19 Feb 2021 17:36:28 +0000 (19:36 +0200)]
Updated from_str_radix_10 sugg to be slightly smarter and ran bless

3 years agocollapsible_match: fix lint message capitalization
Matthias Krüger [Fri, 19 Feb 2021 09:02:17 +0000 (10:02 +0100)]
collapsible_match: fix lint message capitalization

(see https://rustc-dev-guide.rust-lang.org/diagnostics.html for details)

3 years agoChange known problems
Cameron Steffen [Fri, 19 Feb 2021 02:23:49 +0000 (20:23 -0600)]
Change known problems

3 years agoChange unnecessary_wraps to pedantic
Cameron Steffen [Fri, 19 Feb 2021 02:02:58 +0000 (20:02 -0600)]
Change unnecessary_wraps to pedantic

3 years agolintcheck: parallelize
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).

3 years agoAuto merge of #6665 - pag4k:unnecessary_wraps_bug_6640, r=camsteffen
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

3 years agoChanged fn body suggestion msg
Pierre-Andre Gagnon [Thu, 18 Feb 2021 22:32:55 +0000 (17:32 -0500)]
Changed fn body suggestion msg

3 years agoAuto merge of #6763 - flip1995:fix_lintcheck, r=matthiaskrgr
bors [Thu, 18 Feb 2021 22:15:42 +0000 (22:15 +0000)]
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

3 years agoFix lintcheck by excluding checked crates from workspace
flip1995 [Thu, 18 Feb 2021 22:07:19 +0000 (23:07 +0100)]
Fix lintcheck by excluding checked crates from workspace

3 years agoAuto merge of #6759 - Y-Nak:fix-fp-of-result_unit_err, r=llogiq
bors [Thu, 18 Feb 2021 21:39:29 +0000 (21:39 +0000)]
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

3 years agoFix FP of result_unit_err when using type aliases
Yoshitomo Nakanishi [Thu, 18 Feb 2021 09:35:25 +0000 (18:35 +0900)]
Fix FP of result_unit_err when using type aliases

3 years agoAdded detailled suggs for new case
Pierre-Andre Gagnon [Wed, 17 Feb 2021 21:41:50 +0000 (16:41 -0500)]
Added detailled suggs for new case

3 years agoFix match_same_arms with SpanlessEq changes
Cameron Steffen [Wed, 17 Feb 2021 16:02:22 +0000 (10:02 -0600)]
Fix match_same_arms with SpanlessEq changes

3 years agoMake expr_fallback FnMut
Cameron Steffen [Wed, 17 Feb 2021 15:35:55 +0000 (09:35 -0600)]
Make expr_fallback FnMut

3 years agoTeach SpanlessEq binding IDs
Cameron Steffen [Wed, 17 Feb 2021 15:34:35 +0000 (09:34 -0600)]
Teach SpanlessEq binding IDs

3 years agoAuto merge of #6750 - flip1995:lintcheck_options, r=matthiaskrgr
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.

3 years agolintcheck: Add a note that -Wclippy::all is enabled by default
flip1995 [Wed, 17 Feb 2021 07:34:23 +0000 (08:34 +0100)]
lintcheck: Add a note that -Wclippy::all is enabled by default

3 years agoReformat clippy_dev README
flip1995 [Tue, 16 Feb 2021 17:09:34 +0000 (18:09 +0100)]
Reformat clippy_dev README

3 years agoAuto merge of #6749 - camsteffen:test-all, r=Manishearth
bors [Tue, 16 Feb 2021 17:03:03 +0000 (17:03 +0000)]
Auto merge of #6749 - camsteffen:test-all, r=Manishearth

Test workspace at once

changelog: none

Follow-up to #6733

3 years agoTest workspace at once
Cameron Steffen [Tue, 16 Feb 2021 16:39:24 +0000 (10:39 -0600)]
Test workspace at once

3 years agoAdd workspace to manifest
Cameron Steffen [Fri, 12 Feb 2021 22:34:42 +0000 (16:34 -0600)]
Add workspace to manifest

3 years agolintcheck: Slight improvements to the error reporting
flip1995 [Tue, 16 Feb 2021 15:58:00 +0000 (16:58 +0100)]
lintcheck: Slight improvements to the error reporting

3 years agoAdd command line options option to lintcheck crates config
flip1995 [Tue, 16 Feb 2021 12:38:01 +0000 (13:38 +0100)]
Add command line options option to lintcheck crates config

3 years agoAuto merge of #6662 - Y-Nak:default-numeric-fallback, r=flip1995
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
}

fn foo_poly<T>(t: T) -> t {
    t
}

// Good.
let x = foo_mono(13);

// Still bad.
let x: i32 = foo_poly(13);
```

changelog: Added restriction lint: `default_numeric_fallback`

3 years agoChange to span_lint_and_sugg from span_lint_and_help
Yoshitomo Nakanishi [Tue, 16 Feb 2021 09:07:09 +0000 (18:07 +0900)]
Change to span_lint_and_sugg from span_lint_and_help

3 years agoAuto merge of #6744 - matthiaskrgr:lintcheck, r=flip1995
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

3 years agoHandle struct ctor case
Yoshitomo Nakanishi [Tue, 16 Feb 2021 02:20:51 +0000 (11:20 +0900)]
Handle struct ctor case

3 years agolintcheck: update logs
Matthias Krüger [Mon, 15 Feb 2021 22:25:06 +0000 (23:25 +0100)]
lintcheck: update logs

3 years agolintcheck: filter out messages that come from cargo-metadata errors or contain absolu...
Matthias Krüger [Mon, 15 Feb 2021 22:13:41 +0000 (23:13 +0100)]
lintcheck: filter out messages that come from cargo-metadata errors or contain absolute paths to rustc source files

The latter is especially annoying because the paths would change every time we bumped the pinned nightly version.

3 years agolintcheck: print warnings if we can't check out or clone a git repo
Matthias Krüger [Mon, 15 Feb 2021 21:46:58 +0000 (22:46 +0100)]
lintcheck: print warnings if we can't check out or clone a git repo

3 years agolintcheck: fix bug in downloade_and_extract() for git sources: we need to execute...
Matthias Krüger [Mon, 15 Feb 2021 21:36:49 +0000 (22:36 +0100)]
lintcheck: fix bug in downloade_and_extract() for git sources: we need to execute "git checkout xy" inside the repo dir!

3 years agolintcheck: put some code into a gather_stats() function
Matthias Krüger [Sun, 14 Feb 2021 17:59:32 +0000 (18:59 +0100)]
lintcheck: put some code into a gather_stats() function

3 years agolintcheck: rename a few symbols, add documentation to functions
Matthias Krüger [Sun, 14 Feb 2021 17:51:53 +0000 (18:51 +0100)]
lintcheck: rename a few symbols, add documentation to functions

3 years agolintcheck: rename struct field
Matthias Krüger [Sun, 14 Feb 2021 17:37:08 +0000 (18:37 +0100)]
lintcheck: rename struct field

3 years agoAuto merge of #6743 - rust-lang:update-compiletest, r=Manishearth
bors [Mon, 15 Feb 2021 19:18:41 +0000 (19:18 +0000)]
Auto merge of #6743 - rust-lang:update-compiletest, r=Manishearth

Upgrade compiletest-rs to 0.6 and tester to 0.9

These updates allow us to specify multiple testnames for `TESTNAME` by
providing a comma separated list of testnames.

The new version of compiletest-rs also includes `bless` support, but is
not enabled with this PR.

cc #5394

changelog: none

3 years agoUpgrade compiletest-rs to 0.6 and tester to 0.9
Philipp Hansch [Mon, 15 Feb 2021 06:36:25 +0000 (07:36 +0100)]
Upgrade compiletest-rs to 0.6 and tester to 0.9

These updates allow us to specify multiple testnames for `TESTNAME`.

The new version of compiletest-rs also includes `bless` support, but is
not enabled with this PR.

3 years agoAdd more tests for default_numeric_fallback
Yoshitomo Nakanishi [Mon, 15 Feb 2021 14:33:27 +0000 (23:33 +0900)]
Add more tests for default_numeric_fallback

3 years agoAdd fn_sig_opt to get fn signature from HirId
Yoshitomo Nakanishi [Mon, 15 Feb 2021 13:40:28 +0000 (22:40 +0900)]
Add fn_sig_opt to get fn signature from HirId

3 years agoAdd some restrictions to default_numeric_fallback to avoid FNs
Yoshitomo Nakanishi [Mon, 15 Feb 2021 05:22:31 +0000 (14:22 +0900)]
Add some restrictions to default_numeric_fallback to avoid FNs

3 years agoAuto merge of #6741 - ThibsG:BlockInIfConditions1141, r=flip1995
bors [Sun, 14 Feb 2021 15:55:12 +0000 (15:55 +0000)]
Auto merge of #6741 - ThibsG:BlockInIfConditions1141, r=flip1995

Do not lint when the closure is called using an iterator

Fix FP when the closure is used in an iterator for `blocks_in_if_conditions` lint

FIxes: #1141

changelog: none

3 years agoDo not lint when the closure is called using an iterator
ThibsG [Sun, 14 Feb 2021 15:21:12 +0000 (16:21 +0100)]
Do not lint when the closure is called using an iterator

3 years agoAuto merge of #6701 - camsteffen:collapsible-if, r=flip1995
bors [Sun, 14 Feb 2021 14:43:35 +0000 (14:43 +0000)]
Auto merge of #6701 - camsteffen:collapsible-if, r=flip1995

Fix collapsible_if with attributes

changelog: Fix collapsible_if FP with attributes

Fixes #6593

3 years agoAuto merge of #6697 - camsteffen:vec-init-push-fp, r=flip1995
bors [Sun, 14 Feb 2021 14:27:13 +0000 (14:27 +0000)]
Auto merge of #6697 - camsteffen:vec-init-push-fp, r=flip1995

Fix vec_init_then_push false positives

changelog: Fix vec_init_then_push false positives

Fixes #6615

3 years agoAuto merge of #6736 - Y-Nak:reproducer-for-use_self-ice, r=flip1995
bors [Sat, 13 Feb 2021 18:59:59 +0000 (18:59 +0000)]
Auto merge of #6736 - Y-Nak:reproducer-for-use_self-ice, r=flip1995

Add a minimal reproducer for the ICE in #6179

This PR is an auxiliary PR for #6179, just add a minimal reproducer for the ICE discussed in #6179.
See #6179 for more details.

changelog: none

3 years agoAdd minimal reproducer for ICE in #6179
Yoshitomo Nakanishi [Sat, 13 Feb 2021 13:12:59 +0000 (22:12 +0900)]
Add minimal reproducer for ICE in #6179

3 years agoAuto merge of #6735 - matthiaskrgr:lintcheck, r=flip1995
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.

3 years agoUse title case in clippy_dev README
Philipp Krones [Sat, 13 Feb 2021 15:55:01 +0000 (16:55 +0100)]
Use title case in clippy_dev README

3 years agoAuto merge of #6738 - xFrednet:0000-update-labels-in-template-files, r=flip1995
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)

---

changelog: none

3 years agoUpdated labels in template files
xFrednet [Sat, 13 Feb 2021 15:45:34 +0000 (16:45 +0100)]
Updated labels in template files

For context: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Label.20cleanup/near/224083870

3 years agolintcheck: explain sources.toml configuration
Matthias Krüger [Fri, 12 Feb 2021 23:50:13 +0000 (00:50 +0100)]
lintcheck: explain sources.toml configuration

3 years agolintcheck: env var LINTCHECK_TOML can be used to override toml file location (has...
Matthias Krüger [Fri, 12 Feb 2021 23:39:19 +0000 (00:39 +0100)]
lintcheck: env var LINTCHECK_TOML can be used to override toml file location (has precedence over --crates-toml flag)

3 years agoMade parens addition smarter and added tests with bless
boolean_coercion [Fri, 12 Feb 2021 22:33:08 +0000 (00:33 +0200)]
Made parens addition smarter and added tests with bless

3 years agoAuto merge of #6700 - daxpedda:panics-doc-unreachable, r=llogiq
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)

3 years agoFixed typos and updated to matches! where applicable
boolean_coercion [Fri, 12 Feb 2021 09:53:52 +0000 (11:53 +0200)]
Fixed typos and updated to matches! where applicable

3 years agoFixed doctests that shouldn't have been compiled
boolean_coercion [Thu, 11 Feb 2021 11:15:06 +0000 (13:15 +0200)]
Fixed doctests that shouldn't have been compiled

3 years agoRan bless and rustfmt
boolean_coercion [Thu, 11 Feb 2021 10:46:11 +0000 (12:46 +0200)]
Ran bless and rustfmt

3 years agoChanged applicability to MaybeIncorrect because of surrounding braces
boolean_coercion [Thu, 11 Feb 2021 10:42:20 +0000 (12:42 +0200)]
Changed applicability to MaybeIncorrect because of surrounding braces

3 years agofrom_str_radix_10 should be done
boolean_coercion [Thu, 11 Feb 2021 10:30:23 +0000 (12:30 +0200)]
from_str_radix_10 should be done

3 years agoImplemented majority of from_str_radix_10
boolean_coercion [Thu, 11 Feb 2021 00:30:37 +0000 (02:30 +0200)]
Implemented majority of from_str_radix_10

3 years agoAdded boilerplate
boolean_coercion [Wed, 10 Feb 2021 19:47:04 +0000 (21:47 +0200)]
Added boilerplate

3 years agoAuto merge of #6179 - flip1995:rewrite_use_self, r=phansch
bors [Fri, 12 Feb 2021 06:09:07 +0000 (06:09 +0000)]
Auto merge of #6179 - flip1995:rewrite_use_self, r=phansch

Rework use_self impl based on ty::Ty comparison #3410 | Take 2

This builds on top of #5531

I already reviewed and approved the commits by `@montrivo.` So only the review of my commits should be necessary.

I would also appreciate your review `@montrivo,` since you are familiar with the challenges here.

Fixes #3410 and Fixes #4143 (same problem)
Fixes #2843
Fixes #3859
Fixes #4734 and fixes #6221
Fixes #4305
Fixes #5078 (even at expression level now 🎉)
Fixes #3881 and Fixes #4887 (same problem)
Fixes #3909

Not yet: #4140 (test added)

All the credit for the fixes goes to `@montrivo.` I only refactored and copy and pasted his code.

changelog: rewrite [`use_self`] lint and fix multiple (8) FPs. One to go.

3 years agoAuto merge of #6719 - flip1995:changelog, r=xFrednet,flip1995
bors [Thu, 11 Feb 2021 16:06:07 +0000 (16:06 +0000)]
Auto merge of #6719 - flip1995:changelog, r=xFrednet,flip1995

Update changelog for 1.51

~~Don't merge yet. This is the last step of the release process.~~ Release process for 1.50 is done, this can now be merged.

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog/CHANGELOG.md)

changelog: none

3 years agoUpdate changelog for 1.51
flip1995 [Thu, 11 Feb 2021 14:59:38 +0000 (15:59 +0100)]
Update changelog for 1.51

3 years agoAuto merge of #6720 - flip1995:backport_remerge, r=flip1995
bors [Thu, 11 Feb 2021 15:10:42 +0000 (15:10 +0000)]
Auto merge of #6720 - flip1995:backport_remerge, r=flip1995

Backport remerge

changelog: none

r? `@ghost`

3 years agoMerge remote-tracking branch 'upstream/beta' into backport_remerge
flip1995 [Thu, 11 Feb 2021 15:09:12 +0000 (16:09 +0100)]
Merge remote-tracking branch 'upstream/beta' into backport_remerge

3 years agoAuto merge of #6718 - flip1995:rustup, r=flip1995
bors [Thu, 11 Feb 2021 13:38:47 +0000 (13:38 +0000)]
Auto merge of #6718 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none