]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAdd `--msrv` option to `new_lint` command
Michael Wright [Sat, 9 Oct 2021 03:58:05 +0000 (05:58 +0200)]
Add `--msrv` option to `new_lint` command

2 years agoAuto merge of #7789 - flip1995:double_semi_if_nothing_returned, r=camsteffen
bors [Fri, 8 Oct 2021 21:30:16 +0000 (21:30 +0000)]
Auto merge of #7789 - flip1995:double_semi_if_nothing_returned, r=camsteffen

Don't trigger semicolon_if_nothing_returned in expanded code

Fixes #7768

Before, this lint didn't trigger on macros. With rust-lang/rust#88175
this isn't enough anymore. In this PR a `WhileLoop` desugaring kind was
introduced. This overrides the span of expanded expressions when
lowering the while loop. So if a while loop is in a macro, the
expressions that it expands to are no longer marked with
`ExpnKind::Macro`, but with `ExpnKind::Desugaring`. In general, this is
the correct behavior and the same that is done for `ForLoop`s. It just
tripped up this lint.

r? `@camsteffen`

changelog: [`semicolon_if_nothing_returned`]: Fix regression on macros containing while loops

2 years agoDon't trigger semicolon_if_nothing_returned in expanded code
flip1995 [Fri, 8 Oct 2021 14:16:56 +0000 (16:16 +0200)]
Don't trigger semicolon_if_nothing_returned in expanded code

Before this lint didn't trigger on macros. With rust-lang/rust#88175
this isn't enough anymore. In this PR a `WhileLoop` desugaring kind was
introduced. This overrides the span of expanded expressions when
lowering the while loop. So if a while loop is in a macro, the
expressions that it expands to are no longer marked with
`ExpnKind::Macro`, but with `ExpnKind::Desugaring`. In general, this is
the correct behavior and the same that is done for `ForLoop`s. It just
tripped up this lint.

2 years agoAuto merge of #7748 - Serial-ATA:lint-undocumented-unsafe, r=flip1995
bors [Fri, 8 Oct 2021 07:29:26 +0000 (07:29 +0000)]
Auto merge of #7748 - Serial-ATA:lint-undocumented-unsafe, r=flip1995

Add undocumented_unsafe_blocks lint

changelog: Added a new lint [`undocumented_unsafe_blocks`]

Fixes #7464, #7238 (?)

2 years agoAdd undocumented_unsafe_blocks lint
Serial [Sat, 2 Oct 2021 03:25:48 +0000 (23:25 -0400)]
Add undocumented_unsafe_blocks lint

2 years agoAuto merge of #7705 - michaelsproul:fn_to_numeric_cast_any, r=camsteffen
bors [Thu, 7 Oct 2021 14:14:19 +0000 (14:14 +0000)]
Auto merge of #7705 - michaelsproul:fn_to_numeric_cast_any, r=camsteffen

Restriction lint for function pointer casts

The existing lints for function pointer casts cover the cases where a cast is non-portable or would result in truncation, however there's currently no way to forbid numeric function pointer casts entirely.

I've added a new lint `fn_to_numeric_cast_any`, which allows one to ban _all_ numeric function pointer casts, including to `usize`. This is useful if you're writing high-level Rust and want to opt-out of potentially surprising behaviour, avoiding silent bugs from forgotten parentheses, e.g.

```rust
fn foo() -> u32 {
    10
}

fn main() {
    let _ = foo as usize; // oops, forgot to call foo and got a random address instead!
}
```

~~I'm open to suggestions for the naming of the lint, because `fn_to_numeric_cast_any` is a bit clunky. Ideally I'd call this lint `fn_to_numeric_cast`, but that name is already taken for the more specific lint~~. We've stuck with `fn_to_numeric_cast_any` to avoid renaming the existing lint, or choosing a different name that's too generic (like `fn_cast`).

I'm also open to changing the suggestion behaviour, as adding parentheses is only one of many possible ways to fix the lint.

changelog: add ``[`fn_to_numeric_cast_any`]`` restriction lint

2 years agoRestriction lint for function pointer casts
Michael Sproul [Thu, 7 Oct 2021 00:50:14 +0000 (11:50 +1100)]
Restriction lint for function pointer casts

2 years agoAuto merge of #7782 - dswij:shadow-unrelated-block, r=flip1995
bors [Thu, 7 Oct 2021 09:49:19 +0000 (09:49 +0000)]
Auto merge of #7782 - dswij:shadow-unrelated-block, r=flip1995

Make `shadow_reuse` suggestion less verbose

Closes #7764

Make `shadow_reuse` suggestion less verbose.

changelog: [`shadow_reuse`] does not warn shadowing statement

2 years agoAuto merge of #7779 - rust-lang:test_module, r=flip1995
bors [Thu, 7 Oct 2021 09:36:51 +0000 (09:36 +0000)]
Auto merge of #7779 - rust-lang:test_module, r=flip1995

make test module detection more strict

I started with some small improvements to clippy_utils/src/lib.rs, but then found that our "test" module detection would also catch words containing "test" like e.g. "attestation". So I made this a bit more strict (splitting by `'_'` and checking for `test` or `tests`), adding a test case as I went.

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: none

2 years agoAuto merge of #7783 - flip1995:rustup, r=flip1995
bors [Thu, 7 Oct 2021 09:18:25 +0000 (09:18 +0000)]
Auto merge of #7783 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

Finally an easy, conflict free rustup again :tada:

changelog: none

2 years agoBump nightly version -> 2021-10-07
flip1995 [Thu, 7 Oct 2021 09:12:27 +0000 (11:12 +0200)]
Bump nightly version -> 2021-10-07

2 years agoAllow invalid-paths for regex paths
flip1995 [Thu, 7 Oct 2021 09:12:02 +0000 (11:12 +0200)]
Allow invalid-paths for regex paths

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 7 Oct 2021 09:11:23 +0000 (11:11 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoMake `shadow_reuse` suggestion less verbose
dswij [Thu, 7 Oct 2021 08:39:13 +0000 (16:39 +0800)]
Make `shadow_reuse` suggestion less verbose

2 years agoAuto merge of #7780 - mikerite:update_lints_mod_revert, r=llogiq
bors [Thu, 7 Oct 2021 05:00:53 +0000 (05:00 +0000)]
Auto merge of #7780 - mikerite:update_lints_mod_revert, r=llogiq

Revert `update_lints` module list generating code

This commit reverts the module list generation code to what it was
before the change to `include!` it and generates better output.

changelog: none

2 years agoRevert `update_lints` module list generating code
Michael Wright [Thu, 7 Oct 2021 04:37:56 +0000 (06:37 +0200)]
Revert `update_lints` module list generating code

This commit reverts the module list generation code to what it was
before the change to `include!` it and generates better output.

2 years agomake test module detection more strict
Andre Bogus [Wed, 6 Oct 2021 22:14:06 +0000 (00:14 +0200)]
make test module detection more strict

2 years agoAuto merge of #7772 - Manishearth:doc-markdown-intra, r=camsteffen
bors [Wed, 6 Oct 2021 19:16:22 +0000 (19:16 +0000)]
Auto merge of #7772 - Manishearth:doc-markdown-intra, r=camsteffen

Handle intra-doc links in doc_markdown

Fixes #7758

changelog: Handle intra-doc links in [`doc_markdown`]

2 years agoHandle intra-doc links in doc_markdown
Manish Goregaokar [Wed, 6 Oct 2021 07:01:40 +0000 (00:01 -0700)]
Handle intra-doc links in doc_markdown

2 years agoAdd regression test for #7758
Manish Goregaokar [Wed, 6 Oct 2021 06:48:41 +0000 (23:48 -0700)]
Add regression test for #7758

2 years agoAuto merge of #7776 - tsoutsman:patch-1, r=flip1995
bors [Wed, 6 Oct 2021 13:23:13 +0000 (13:23 +0000)]
Auto merge of #7776 - tsoutsman:patch-1, r=flip1995

Fix typos

I'm not sure whether I should add links to `bool`, `char`, and `str`. `slice` could also be linked to.

changelog: none

2 years agoFix typos
Klim Tsoutsman [Wed, 6 Oct 2021 12:32:22 +0000 (23:32 +1100)]
Fix typos

I'm not sure whether I should add links to `bool`, `char`, and `str`. `slice` could also be linked to.

2 years agoAuto merge of #7774 - dswij:useless-exponent, r=llogiq
bors [Wed, 6 Oct 2021 07:54:27 +0000 (07:54 +0000)]
Auto merge of #7774 - dswij:useless-exponent, r=llogiq

Useless exponent

Closes #7745

I'm open to some thoughts on dropping the exponents on suggestions when it's zero. I personally don't see any problem on this.

changelog: [`useless_exponent`] suggestion drops exponent when exponent value is zero

2 years agoAuto merge of #7773 - Manishearth:update-lints-mods, r=flip1995
bors [Wed, 6 Oct 2021 07:38:38 +0000 (07:38 +0000)]
Auto merge of #7773 - Manishearth:update-lints-mods, r=flip1995

Move module declarations back into lib.rs

With #7673 we moved a lot of things from lib.rs to lib.foo.rs. Unfortunately, rustfmt doesn't seem to work when module declarations are included via `include!` (and trying the `mod foo; use foo::*;` trick doesn't seem to work much either in our specific case).

With this PR we continue generating everything in subfiles except for module declarations, which are now generated within lib.rs.

changelog: none

2 years agoAdd tests for zero exponents in `excessive_precision`
dswij [Wed, 6 Oct 2021 07:33:05 +0000 (15:33 +0800)]
Add tests for zero exponents in `excessive_precision`

2 years agoRegen update_lints
Manish Goregaokar [Wed, 6 Oct 2021 07:12:58 +0000 (00:12 -0700)]
Regen update_lints

2 years agoReturn to generating mod declarations in lib.rs
Manish Goregaokar [Wed, 6 Oct 2021 07:12:38 +0000 (00:12 -0700)]
Return to generating mod declarations in lib.rs

2 years agoDrop exponent suggestion when 0
dswij [Wed, 6 Oct 2021 07:02:38 +0000 (15:02 +0800)]
Drop exponent suggestion when 0

This commit changes numeric literal formatting to drop exponent when
exponent is 0.

2 years agoAuto merge of #7770 - zvavybir:master, r=xFrednet
bors [Tue, 5 Oct 2021 19:51:09 +0000 (19:51 +0000)]
Auto merge of #7770 - zvavybir:master, r=xFrednet

improved help message for `suspicious_map`

`suspicious_map`'s help message assumes that the literal behavior is never the intended one, although it's sometimes.  This PR adds a mention of `inspect`, offering a idiomatic alternative.

fixes #7767

---

changelog: Improved help message of [`suspicious_map`].

2 years agoMentioned `inspect` in lint description of `suspicious_map`
Matthias Kaak [Tue, 5 Oct 2021 19:40:15 +0000 (19:40 +0000)]
Mentioned `inspect` in lint description of `suspicious_map`

2 years agoimproved help message for `suspicious_map`
Matthias Kaak [Tue, 5 Oct 2021 19:03:13 +0000 (19:03 +0000)]
improved help message for `suspicious_map`

2 years agoAuto merge of #7762 - HKalbasi:master, r=Manishearth
bors [Mon, 4 Oct 2021 19:38:04 +0000 (19:38 +0000)]
Auto merge of #7762 - HKalbasi:master, r=Manishearth

Add lint `equatable_if_let`

This is my attempt for #1716. There is a major false positive, which is people may implement `PartialEq` in a different way. It is unactionable at the moment so I put it into `nursery`.

There is a trait `StructuralPartialEq` for solving this problem which is promising but it has several problems currently:
* Integers and tuples doesn't implement it.
* Some types wrongly implement it, like `Option<T>` when `T` doesn't implement it.

I consider them bugs and against the propose of `StructuralPartialEq`. When they become fixed, this lint can become a useful lint with a single line change.

changelog: New lint: [`equatable_if_let`]

2 years agoImplement equatable if let lint
hkalbasi [Mon, 4 Oct 2021 06:33:40 +0000 (10:03 +0330)]
Implement equatable if let lint

2 years agoAuto merge of #7761 - giraffate:fix_ice_in_inplicit_hasher, r=Manishearth
bors [Mon, 4 Oct 2021 17:07:00 +0000 (17:07 +0000)]
Auto merge of #7761 - giraffate:fix_ice_in_inplicit_hasher, r=Manishearth

Fix ICE in `implicit_hasher`

close #7712

changelog: Fix ICE in [`implicit_hasher`]

2 years agoFix ICE in `implicit_hasher`
Takayuki Nakata [Mon, 4 Oct 2021 14:31:40 +0000 (23:31 +0900)]
Fix ICE in `implicit_hasher`

2 years agoAuto merge of #88175 - camsteffen:let-desugar-span, r=Manishearth
bors [Sun, 3 Oct 2021 21:44:10 +0000 (21:44 +0000)]
Auto merge of #88175 - camsteffen:let-desugar-span, r=Manishearth

Add expansion to while desugar spans

In the same vein as #88163, this reverts a change in Clippy behavior as a result of #80357 (and reverts some `#[allow]`s): This changes `clippy::blocks_in_if_conditions` to not fire on `while` loops. Though we might actually want Clippy to lint those cases, we should introduce the change purposefully, with tests, and possibly under a different lint name.

The actual change here is to add a desugaring expansion to the spans when lowering a `while` loop.

r? `@Manishearth`

2 years agoAuto merge of #7755 - HKalbasi:master, r=xFrednet
bors [Sun, 3 Oct 2021 10:30:16 +0000 (10:30 +0000)]
Auto merge of #7755 - HKalbasi:master, r=xFrednet

exclude enum from derivable impls

fix #7753

changelog: Exclude enum from ``[`derivable_impls`]``

2 years agoChange not enum to is struct
HKalbasi [Sun, 3 Oct 2021 09:31:57 +0000 (13:01 +0330)]
Change not enum to is struct

2 years agoAuto merge of #7709 - Qwaz:drop_non_send, r=xFrednet
bors [Sun, 3 Oct 2021 08:43:32 +0000 (08:43 +0000)]
Auto merge of #7709 - Qwaz:drop_non_send, r=xFrednet

Implement `non_send_field_in_send_ty` lint

changelog: Implement [`non_send_fields_in_send_ty`] lint

Fixes #7703

2 years agoexclude enum from derivable impls
hkalbasi [Sun, 3 Oct 2021 08:28:27 +0000 (11:58 +0330)]
exclude enum from derivable impls

2 years agoMake diangostic item names consistent
Cameron Steffen [Sat, 2 Oct 2021 23:51:01 +0000 (18:51 -0500)]
Make diangostic item names consistent

2 years agoUpdate documentation and name for non_send_fields_in_send_ty lint
Yechan Bae [Sat, 2 Oct 2021 23:22:37 +0000 (19:22 -0400)]
Update documentation and name for non_send_fields_in_send_ty lint

2 years agoAdd desugaring mark to while loop
Cameron Steffen [Thu, 19 Aug 2021 21:57:15 +0000 (16:57 -0500)]
Add desugaring mark to while loop

2 years agoAuto merge of #7747 - Manishearth:excessive-precision, r=xFrednet
bors [Sat, 2 Oct 2021 16:12:30 +0000 (16:12 +0000)]
Auto merge of #7747 - Manishearth:excessive-precision, r=xFrednet

Correctly handle signs in exponents in numeric_literal::format()

Fixes #7744

changelog: Correctly handle signs in exponents in `numeric_literal::format()`

2 years agoCorrectly handle signs in exponents in numeric_literal::format()
Manish Goregaokar [Sat, 2 Oct 2021 00:27:47 +0000 (17:27 -0700)]
Correctly handle signs in exponents in numeric_literal::format()

2 years agoAdd regression test
Manish Goregaokar [Fri, 1 Oct 2021 23:14:35 +0000 (16:14 -0700)]
Add regression test

2 years agoAuto merge of #89449 - Manishearth:rollup-3alb61f, r=Manishearth
bors [Fri, 1 Oct 2021 22:47:22 +0000 (22:47 +0000)]
Auto merge of #89449 - Manishearth:rollup-3alb61f, r=Manishearth

Rollup of 7 pull requests

Successful merges:

 - #85223 (rustdoc: Clarified the attribute which prompts the warning)
 - #88847 (platform-support.md: correct ARMv7+MUSL platform triple notes)
 - #88963 (Coerce const FnDefs to implement const Fn traits )
 - #89376 (Fix use after drop in self-profile with llvm events)
 - #89422 (Replace whitespaces in doctests' name with dashes)
 - #89440 (Clarify a sentence in the documentation of Vec (#84488))
 - #89441 (Normalize after substituting via `field.ty()`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #88963 - fee1-dead:const-iterator, r=oli-obk
Manish Goregaokar [Fri, 1 Oct 2021 21:46:48 +0000 (14:46 -0700)]
Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obk

Coerce const FnDefs to implement const Fn traits

You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`.

r? ``@oli-obk``

``@rustbot`` label T-compiler F-const_trait_impl

2 years agoAuto merge of #88880 - cjgillot:no-krate, r=oli-obk
bors [Fri, 1 Oct 2021 20:06:34 +0000 (20:06 +0000)]
Auto merge of #88880 - cjgillot:no-krate, r=oli-obk

Rework HIR API to make invocations of the hir_crate query harder.

`hir_crate` forces the recomputation of queries that depend on it.

This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.

2 years agoForgot to bless ui-toml test
Yechan Bae [Fri, 1 Oct 2021 18:26:04 +0000 (14:26 -0400)]
Forgot to bless ui-toml test

2 years agoDo not use full type path in help message
Yechan Bae [Fri, 1 Oct 2021 18:00:50 +0000 (14:00 -0400)]
Do not use full type path in help message

2 years agoAdd ui-test for enable-raw-pointer-heuristic-for-send config
Yechan Bae [Fri, 1 Oct 2021 17:07:25 +0000 (13:07 -0400)]
Add ui-test for enable-raw-pointer-heuristic-for-send config

2 years agoMinor changes from PR feedback
Yechan Bae [Fri, 1 Oct 2021 16:47:54 +0000 (12:47 -0400)]
Minor changes from PR feedback

2 years agoAdd configuration for raw pointer heuristic
Yechan Bae [Tue, 28 Sep 2021 20:55:36 +0000 (16:55 -0400)]
Add configuration for raw pointer heuristic

2 years agoLook into tuple, array, ADT args in raw pointer heuristic
Yechan Bae [Tue, 28 Sep 2021 20:42:27 +0000 (16:42 -0400)]
Look into tuple, array, ADT args in raw pointer heuristic

2 years agoEmit one report for all fields in the same ADT
Yechan Bae [Tue, 28 Sep 2021 19:23:39 +0000 (15:23 -0400)]
Emit one report for all fields in the same ADT

2 years agoUpdate documentation
Yechan Bae [Tue, 28 Sep 2021 17:46:13 +0000 (13:46 -0400)]
Update documentation

2 years agotypo
Yechan Bae [Thu, 23 Sep 2021 10:49:23 +0000 (06:49 -0400)]
typo

2 years agoFix attribute handling
Yechan Bae [Thu, 23 Sep 2021 10:45:24 +0000 (06:45 -0400)]
Fix attribute handling

2 years agoInitial implementation
Yechan Bae [Thu, 23 Sep 2021 07:51:10 +0000 (03:51 -0400)]
Initial implementation

2 years agoAuto merge of #7741 - surechen:fix_if_then_panic, r=flip1995
bors [Fri, 1 Oct 2021 10:04:19 +0000 (10:04 +0000)]
Auto merge of #7741 - surechen:fix_if_then_panic, r=flip1995

Make if_then_panic handle situation of BinOpKind::And || BinOpKind::Or

fixes #7731

Make if_then_panic handle situation of cond.kind = ExprKind::DropTemps(ExprKind::Binary(BinOpKind::And || BinOpKind::Or, left, right), ..) =

changelog: [`if_then_panic`] Fix suggestion for more complex conditions

2 years agouse sugg::Sugg::maybe_par
surechen [Fri, 1 Oct 2021 05:13:09 +0000 (13:13 +0800)]
use sugg::Sugg::maybe_par

2 years agoRollup merge of #88782 - asquared31415:issue-79559, r=cjgillot
Manish Goregaokar [Fri, 1 Oct 2021 01:05:20 +0000 (18:05 -0700)]
Rollup merge of #88782 - asquared31415:issue-79559, r=cjgillot

Fix ICE when `start` lang item has wrong generics

In my previous pr #87875 I missed the requirements on the `start` lang item due to its relative difficulty to test and opting for more conservative estimates.  This fixes that by updating the requirement to be exactly one generic type.

The `start` lang item should have exactly one generic type for the return type of the `main` fn ptr passed to it.  I believe having zero would previously *sometimes* compile (often with the use of `fn() -> ()` as the fn ptr but it was likely UB to call if the return type of `main` was not `()` as far as I know) however it also sometimes would not for various errors including ICEs and LLVM errors depending on exact situations.  Having more than 1 generic has always failed with an ICE because only the one generic type is expected and provided.

Fixes #79559, fixes #73584, fixes #83117 (all duplicates)
Relevant to #9307

r? ````@cjgillot````

2 years agoAuto merge of #7338 - camsteffen:shadow, r=llogic
bors [Thu, 30 Sep 2021 19:08:22 +0000 (19:08 +0000)]
Auto merge of #7338 - camsteffen:shadow, r=llogic

Re-write shadow lints

changelog: Move shadow_unrelated to restriction
changelog: The shadow lints find a lot more shadows and are not limited to certain patterns

Drastically simplifies the implementation. Catches a lot more cases.

I removed the "initialization happens here" note. It is not helpful IMO.

Closes #318
Fixes #2890
Fixes #6563
Fixes #7588
Fixes #7620

2 years agoRemove shadow allows
Cameron Steffen [Mon, 27 Sep 2021 22:19:33 +0000 (17:19 -0500)]
Remove shadow allows

2 years agoRewrite shadow lint
Cameron Steffen [Sun, 10 Jan 2021 23:51:43 +0000 (17:51 -0600)]
Rewrite shadow lint

2 years agoRemove initialization note from shadow lint
Cameron Steffen [Mon, 11 Jan 2021 15:10:24 +0000 (09:10 -0600)]
Remove initialization note from shadow lint

2 years agoMove shadow_unrelated to restriction
Cameron Steffen [Sat, 25 Sep 2021 22:14:34 +0000 (17:14 -0500)]
Move shadow_unrelated to restriction

2 years agoDo not pass hir::Crate to lints.
Camille GILLOT [Sun, 12 Sep 2021 09:58:27 +0000 (11:58 +0200)]
Do not pass hir::Crate to lints.

2 years agoAuto merge of #7677 - surechen:edit_large_enum_variant, r=camsteffen
bors [Thu, 30 Sep 2021 12:45:17 +0000 (12:45 +0000)]
Auto merge of #7677 - surechen:edit_large_enum_variant, r=camsteffen

fix bug for large_enum_variants

Fix the discussion problem in the issue of https://github.com/rust-lang/rust-clippy/issues/7666#issuecomment-919654291

About the false positive problem of case:
```rust
enum LargeEnum6 {
    A,
    B([u8;255]),
    C([u8;200]),
}
```

changelog: Fix largest_enum_variant wrongly identifying the second largest variant.

2 years agofix issue #7731
surechen [Thu, 30 Sep 2021 11:06:42 +0000 (19:06 +0800)]
fix issue #7731

Make if_then_else handle situation of cond.kind = ExprKind::DropTemps(ExprKind::Binary(BinOpKind::And || BinOpKind::Or, left, right), ..) =

2 years agoAuto merge of #7684 - surechen:solve_derivable_impls, r=flip1995
bors [Thu, 30 Sep 2021 08:19:58 +0000 (08:19 +0000)]
Auto merge of #7684 - surechen:solve_derivable_impls, r=flip1995

fix for issue #7683

Fixes #7683.

For Repeat  [x; y] (x is the type and y is the times to repeat) . When y > 32, the compiler will report an error:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7148558162685e91056e0550797ea74c

Because https://github.com/rust-lang/rust/blob/6cdd42f9f8dd4e5e5ba0aa816bc4c99ab8b102f9/library/std/src/primitive_docs.rs#L538
/// Arrays of sizes from 0 to 32 (inclusive) implement [`Default`] trait
/// if the element type allows it. As a stopgap, trait implementations are
/// statically generated up to size 32.

So here to detect this situation.

changelog: [`derivable_impls`]: No longer lints when arrays bigger than 32 elements are involved

2 years agoAuto merge of #7673 - mikerite:include-generated-code, r=giraffate
bors [Thu, 30 Sep 2021 03:58:47 +0000 (03:58 +0000)]
Auto merge of #7673 - mikerite:include-generated-code, r=giraffate

Move code generated by `update_lints` to includes

Move code generated by `update_lints` to includes

changelog: none

2 years agoFix comment in `update_lints`
mikerite [Thu, 30 Sep 2021 03:11:39 +0000 (05:11 +0200)]
Fix comment in `update_lints`

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2 years agoArrays of sizes from 0 to 32 (inclusive) implement [Default] trait, edit method is_de...
surechen [Sat, 18 Sep 2021 10:35:17 +0000 (18:35 +0800)]
Arrays of sizes from 0 to 32 (inclusive) implement [Default] trait, edit method is_default_equivalent() to satisfy with this.

2 years agofix bug for large_enum_variants
surechen [Thu, 16 Sep 2021 08:42:36 +0000 (16:42 +0800)]
fix bug for large_enum_variants

2 years agoAvoid more invocations of hir_crate query.
Camille GILLOT [Sat, 11 Sep 2021 23:11:22 +0000 (01:11 +0200)]
Avoid more invocations of hir_crate query.

2 years agoAdd includes to pre-commit hook
Michael Wright [Sat, 18 Sep 2021 04:57:03 +0000 (06:57 +0200)]
Add includes to pre-commit hook

2 years agoAdd test module for `update_lints`
Michael Wright [Sat, 18 Sep 2021 04:43:39 +0000 (06:43 +0200)]
Add test module for `update_lints`

2 years agoMove `update_lints` specific code out of `lib`
Michael Wright [Sat, 18 Sep 2021 04:43:39 +0000 (06:43 +0200)]
Move `update_lints` specific code out of `lib`

2 years agoFix lint register code format
Michael Wright [Sat, 18 Sep 2021 04:43:39 +0000 (06:43 +0200)]
Fix lint register code format

Also change the generation functions to return `String` instead of
`Vec<String>`. This makes sense now as the updates aren't line oriented
anymore.

2 years agoMove code generated by `update_lints` to includes
Michael Wright [Sat, 18 Sep 2021 04:43:39 +0000 (06:43 +0200)]
Move code generated by `update_lints` to includes

2 years agoAuto merge of #7736 - vxpm:master, r=giraffate
bors [Wed, 29 Sep 2021 00:10:49 +0000 (00:10 +0000)]
Auto merge of #7736 - vxpm:master, r=giraffate

Fix typo ("asynx" corrected to "async")

changelog: Fixed small typo in [`await_holding_lock`]'s documentation - "asynx" was corrected to "async"

2 years agoFix typo ("asynx" corrected to "async")
vxpm [Tue, 28 Sep 2021 20:53:12 +0000 (17:53 -0300)]
Fix typo ("asynx" corrected to "async")

2 years agoAuto merge of #7734 - Manishearth:doc-unsafe-trait, r=camsteffen
bors [Tue, 28 Sep 2021 17:09:34 +0000 (17:09 +0000)]
Auto merge of #7734 - Manishearth:doc-unsafe-trait, r=camsteffen

Make `doc_unsafe` warn on unsafe traits as well

Fixes #7732

changelog: Make [`doc_unsafe`] warn on unsafe traits as well

2 years agoMerge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyup
flip1995 [Tue, 28 Sep 2021 17:03:12 +0000 (18:03 +0100)]
Merge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyup

2 years agoAuto merge of #7711 - camsteffen:depinfo-error, r=flip1995
bors [Tue, 28 Sep 2021 16:56:02 +0000 (16:56 +0000)]
Auto merge of #7711 - camsteffen:depinfo-error, r=flip1995

Improve depinfo error

changelog: none

r? `@flip1995`

2 years agoAuto merge of #7733 - flip1995:rustup, r=flip1995
bors [Tue, 28 Sep 2021 16:42:31 +0000 (16:42 +0000)]
Auto merge of #7733 - flip1995:rustup, r=flip1995

Rustup

This needs a review this time. Especially https://github.com/rust-lang/rust-clippy/commit/521bf8f0fa18c7f130505f0a902ab0e65a76cec2 cc `@camsteffen` I think this is necessary now, because `itertools` is no longer a dependency of `clippy_utils` and therefore this path can't be found :thinking:

( I forgot about the sync last week. I should get to document this process better, so other people can do it when I'm not around )

changelog: none

2 years agoCleanup of rustup changes
flip1995 [Tue, 28 Sep 2021 16:40:06 +0000 (17:40 +0100)]
Cleanup of rustup changes

2 years agoBump nightly version -> 2021-09-28
flip1995 [Tue, 28 Sep 2021 09:54:04 +0000 (10:54 +0100)]
Bump nightly version -> 2021-09-28

2 years agoUpdate clippy_lints/src/doc.rs
Manish Goregaokar [Tue, 28 Sep 2021 16:37:11 +0000 (09:37 -0700)]
Update clippy_lints/src/doc.rs

Co-authored-by: Cameron Steffen <cam.steffen94@gmail.com>
2 years agoAllow internal lint INVALID_PATHS for itertools path
flip1995 [Tue, 28 Sep 2021 09:53:11 +0000 (10:53 +0100)]
Allow internal lint INVALID_PATHS for itertools path

Since clippy_utils doesn't depend on the itertools crate anymore, the
lint can't find the path.

2 years agoMake doc_unsafe lint on unsafe traits as well
Manish Goregaokar [Tue, 28 Sep 2021 15:33:58 +0000 (08:33 -0700)]
Make doc_unsafe lint on unsafe traits as well

2 years agoAuto merge of #7727 - flip1995:changelog, r=xFrednet
bors [Tue, 28 Sep 2021 10:27:47 +0000 (10:27 +0000)]
Auto merge of #7727 - flip1995:changelog, r=xFrednet

Update changelog to 1.56

As expected a pretty short changelog, because of the missed sync last release cycle.

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

changelog: none

2 years agoFix CHANGELOG formatting
flip1995 [Tue, 28 Sep 2021 10:08:40 +0000 (11:08 +0100)]
Fix CHANGELOG formatting

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Tue, 28 Sep 2021 09:50:56 +0000 (10:50 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #7608 - andrewpollack:7594/while_let_some_result, r=Manishearth
bors [Tue, 28 Sep 2021 05:33:57 +0000 (05:33 +0000)]
Auto merge of #7608 - andrewpollack:7594/while_let_some_result, r=Manishearth

#7594: Adding new 'while_let_some_result' linting

Excited for the opportunity to contribute to Clippy! Since the latest Bay Area Rust Meetup, I've been looking for an opportunity and found it :smile:

Please let me know how I can improve this PR! Much of it is similar to ``[`if_let_some_result`]``, but I followed the description in the issue to create its own linting rules. Looking forward to feedback, and continuing to work on Clippy in the future!

changelog: Renamed Lint: `if_let_some_result` is now called [`match_result_ok`]. Now also handles `while let` case.

2 years agofmt
Manish Goregaokar [Tue, 28 Sep 2021 05:33:45 +0000 (22:33 -0700)]
fmt

2 years agoAdd renamed lint
Manish Goregaokar [Tue, 28 Sep 2021 05:26:14 +0000 (22:26 -0700)]
Add renamed lint

2 years agoUse a single if_chain
Manish Goregaokar [Tue, 28 Sep 2021 05:09:23 +0000 (22:09 -0700)]
Use a single if_chain