]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoUpdate docs for `expl_impl_clone_on_copy`. Bug was fixed in 879fa5c9721c89c27be6a9db5...
Jason Newcomb [Mon, 16 Aug 2021 23:57:14 +0000 (19:57 -0400)]
Update docs for `expl_impl_clone_on_copy`. Bug was fixed in 879fa5c9721c89c27be6a9db5f51d935a51f549b1~

2 years agoAuto merge of #7566 - dswij:manual-flatten-use, r=xFrednet
bors [Mon, 16 Aug 2021 08:35:06 +0000 (08:35 +0000)]
Auto merge of #7566 - dswij:manual-flatten-use, r=xFrednet

Check expr usage for  `manual_flatten`

Fixes #6784
Fixes #7538

`manual_flatten` should not trigger when `if let` match expression will be used.

changelog: [`manual_flatten`] checks for expr usage after `if let`

2 years agoCheck `if let` expr usage in `manual_flatten`
dswij [Sat, 14 Aug 2021 09:43:28 +0000 (17:43 +0800)]
Check `if let` expr usage in `manual_flatten`

`manual_flatten` should not trigger when match expression in `if let` is
going to be used.

2 years agoAdd false positive test for `manual_flatten`
dswij [Sat, 14 Aug 2021 08:59:08 +0000 (16:59 +0800)]
Add false positive test for `manual_flatten`

Add a scenario where `manual_flatten` is triggered when match expression will still be used after the match in `if let`.

2 years agoAuto merge of #7531 - Jarcho:manual_map_7413, r=camsteffen
bors [Mon, 16 Aug 2021 01:48:01 +0000 (01:48 +0000)]
Auto merge of #7531 - Jarcho:manual_map_7413, r=camsteffen

Manual map 7413

fixes: #7413

This only fixes the specific problem from #7413, not the general case. The full fix requires interacting with the borrow checker to determine the lifetime of all the borrows made in the function. I'll open an issue about it later.

changelog: Don't suggest using `map` when the option is borrowed in the match, and also consumed in the arm.
changelog: Locals declared within the would-be closure will not prevent the closure from being suggested in `manual_map` and `map_entry`

2 years agoUse `each_binding_or_first` in `capture_local_usage`
Jason Newcomb [Mon, 16 Aug 2021 00:25:10 +0000 (20:25 -0400)]
Use `each_binding_or_first` in `capture_local_usage`

2 years agoAuto merge of #7521 - rukai:fix_lintcheck_local_path_handling, r=camsteffen
bors [Mon, 16 Aug 2021 00:20:31 +0000 (00:20 +0000)]
Auto merge of #7521 - rukai:fix_lintcheck_local_path_handling, r=camsteffen

lintcheck always copies in a fresh crate when provided with a crate path

changelog: none

When lintcheck is run on local crates it copies the crate to `target/lintcheck/sources/crate_name` on the first run only.
Then in subsequent runs of lintcheck it reuses this same copy.
This caching behaviour makes sense when dealing with immutable crates.io releases and git commits.
However it is quite surprising that the changes to my local crate are not used when I run lintcheck.

To fix this I removed the copy, instead clippy runs directly off the provided crate folder.
I have tested this and have not observed any negative effects from doing this.
But maybe i'm missing something as im not familiar with clippy!

Alternatively we could make it copy the entire crate every run, but that seems problematic to me as multi-gigabyte target folders will take a long time to copy and wear down SSDs for developers who frequently run lintcheck.

2 years agoLintcheck always copies in a fresh crate when provided with a crate path
Lucas Kent [Sat, 31 Jul 2021 07:50:12 +0000 (17:50 +1000)]
Lintcheck always copies in a fresh crate when provided with a crate path
but skips directories containing CACHEDIR.TAG e.g. the target/ dir

2 years agoAuto merge of #7568 - dtolnay-contrib:ifletelse, r=llogiq
bors [Sun, 15 Aug 2021 12:02:24 +0000 (12:02 +0000)]
Auto merge of #7568 - dtolnay-contrib:ifletelse, r=llogiq

Downgrade option_if_let_else to nursery

I believe that this lint's loose understanding of ownership (#5822, #6737) makes it unsuitable to be enabled by default in its current state, even as a pedantic lint.

Additionally the lint has known problems with type inference (#6137), though I may be willing to consider this a non-blocker in isolation if it weren't for the ownership false positives.

A fourth false positive involving const fn: #7567.

But on top of these, for me the biggest issue is I basically fully agree with https://github.com/rust-lang/rust-clippy/issues/6137#issuecomment-705605688. In my experience this lint universally makes code worse even when the resulting code does compile.

---

changelog: remove [`option_if_let_else`] from default set of enabled lints

2 years agoupdate stderr messages
Jason Newcomb [Sat, 14 Aug 2021 23:52:59 +0000 (19:52 -0400)]
update stderr messages

2 years agoImprove doc for `can_move_expr_to_closure_no_visit`
Jason Newcomb [Mon, 9 Aug 2021 20:26:27 +0000 (16:26 -0400)]
Improve doc for `can_move_expr_to_closure_no_visit`

2 years agoFix tracking of which locals would need to be captured in a closure.
Jason Newcomb [Mon, 9 Aug 2021 18:18:53 +0000 (14:18 -0400)]
Fix tracking of which locals would need to be captured in a closure.
* Captures by sub closures are now considered
* Copy types are correctly borrowed by reference when their value is used
* Fields are no longer automatically borrowed by value
* Bindings in `match` and `let` patterns are now checked to determine how a local is captured

2 years agoImprove `manual_map`
Jason Newcomb [Wed, 4 Aug 2021 17:48:45 +0000 (13:48 -0400)]
Improve `manual_map`
In some cases check if a borrow made in the scrutinee expression would prevent creating the closure used by `map`

2 years agoImprove `manual_map` and `map_entry`
Jason Newcomb [Sun, 1 Aug 2021 22:39:56 +0000 (18:39 -0400)]
Improve `manual_map` and `map_entry`
Locals which can be partially moved created within the to-be-created closure shouldn't block the use of a closure

2 years agoDowngrade option_if_let_else to nursery
David Tolnay [Sat, 14 Aug 2021 12:47:01 +0000 (05:47 -0700)]
Downgrade option_if_let_else to nursery

2 years agoAuto merge of #7562 - dswij:filter-next-false-positive, r=xFrednet
bors [Fri, 13 Aug 2021 07:49:52 +0000 (07:49 +0000)]
Auto merge of #7562 - dswij:filter-next-false-positive, r=xFrednet

Fix false positive on `filter_next`

fixes #7561

changelog: Fix false positive on [`filter_next`] when a method does not implement `Iterator`

2 years agoFix false positive on `filter_next`
dswij [Fri, 13 Aug 2021 06:36:40 +0000 (14:36 +0800)]
Fix false positive on `filter_next`

2 years agoAdd false positive test for iterator method
dswij [Fri, 13 Aug 2021 06:34:33 +0000 (14:34 +0800)]
Add false positive test for iterator method

2 years agoAuto merge of #7560 - xFrednet:7289-configuration-for-every-type-lint, r=camsteffen
bors [Thu, 12 Aug 2021 20:20:58 +0000 (20:20 +0000)]
Auto merge of #7560 - xFrednet:7289-configuration-for-every-type-lint, r=camsteffen

Use `avoid-breaking-exported-api` configuration in types module

This PR empowers our lovely `avoid-breaking-exported-api` configuration value to also influence the emission of lints inside the `types` module.

(That's pretty much it, not really a change worthy of writing a fairy tale about. Don't get me wrong, I would love to write a short one, but I sadly need to study now).

---

Closes: rust-lang/rust-clippy#7489
changelog: The `avoid-breaking-exported-api` configuration now also works for [`box_vec`], [`redundant_allocation`], [`rc_buffer`], [`vec_box`], [`option_option`], [`linkedlist`], [`rc_mutex`]

changelog: [`rc_mutex`]: update the lint message to comply with the normal format

---

r? `@camsteffen,` as you implemented the configuration value

cc: `@flip1995,` as we've discussed this change in rust-lang/rust-clippy#7308

2 years agoUpdate type UI tests to use private items
xFrednet [Thu, 12 Aug 2021 11:15:15 +0000 (13:15 +0200)]
Update type UI tests to use private items

2 years agoUse `avoid_breaking_exported_api` for `types` module lints
xFrednet [Thu, 12 Aug 2021 10:05:02 +0000 (12:05 +0200)]
Use `avoid_breaking_exported_api` for `types` module lints

Addressed PR reviews regarding code style

2 years agoUpdated lint message for `rc_mutex`
xFrednet [Thu, 12 Aug 2021 10:11:26 +0000 (12:11 +0200)]
Updated lint message for `rc_mutex`

2 years agoAuto merge of #7558 - flip1995:rustup, r=flip1995
bors [Thu, 12 Aug 2021 09:13:53 +0000 (09:13 +0000)]
Auto merge of #7558 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-08-12
flip1995 [Thu, 12 Aug 2021 09:09:15 +0000 (11:09 +0200)]
Bump nightly version -> 2021-08-12

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 12 Aug 2021 08:58:44 +0000 (10:58 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #7546 - mgeier:patch-1, r=giraffate
bors [Thu, 12 Aug 2021 08:16:50 +0000 (08:16 +0000)]
Auto merge of #7546 - mgeier:patch-1, r=giraffate

similar_names: allow "iter" and "item"

changelog: [`similar_names`] no longer complains about `iter` and `item` being too similar

2 years agoAuto merge of #7516 - lf-:unwrap-or-default, r=xFrednet
bors [Thu, 12 Aug 2021 08:02:44 +0000 (08:02 +0000)]
Auto merge of #7516 - lf-:unwrap-or-default, r=xFrednet

Add `unwrap_or_else_default` lint

---

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

changelog: Add a new [`unwrap_or_else_default`] style lint. This will catch `unwrap_or_else(Default::default)` on Result and Option and suggest `unwrap_or_default()` instead.

2 years agoAuto merge of #7556 - F3real:no_effect_inclusive_range, r=flip1995
bors [Thu, 12 Aug 2021 07:47:07 +0000 (07:47 +0000)]
Auto merge of #7556 - F3real:no_effect_inclusive_range, r=flip1995

No effect inclusive range

I noticed during last PR that range expression is `ExprKind::Struct` while inclusive range is `ExprKind::Call` which was why it was not handled. This PR adds check for this case.

changelog: [`no_effect]` Report inclusive range in no_effect lint

2 years agoReword is_trait_item description
Jade [Thu, 12 Aug 2021 01:28:42 +0000 (18:28 -0700)]
Reword is_trait_item description

2 years agoCorrectly report inclusive range in no_effect lint
F3real [Wed, 11 Aug 2021 21:46:13 +0000 (23:46 +0200)]
Correctly report inclusive range in no_effect lint

2 years agofix line numbers
Matthias Geier [Wed, 11 Aug 2021 18:42:01 +0000 (20:42 +0200)]
fix line numbers

2 years agorustfmt
Matthias Geier [Wed, 11 Aug 2021 18:35:48 +0000 (20:35 +0200)]
rustfmt

2 years agoAdd test for similar names "iter" and "item"
Matthias Geier [Wed, 11 Aug 2021 18:32:26 +0000 (20:32 +0200)]
Add test for similar names "iter" and "item"

2 years agoAuto merge of #7541 - LeSeulArtichaut:for-never-loop, r=camsteffen
bors [Wed, 11 Aug 2021 14:49:37 +0000 (14:49 +0000)]
Auto merge of #7541 - LeSeulArtichaut:for-never-loop, r=camsteffen

`never_loop`: suggest using an `if let` instead of a `for` loop

changelog: suggest using an `if let` statement instead of a `for` loop that [`never_loop`]s

Fixes #7537, r? `@camsteffen.`

2 years ago`never_loop`: suggest using an `if let` instead of a `for` loop
LeSeulArtichaut [Fri, 6 Aug 2021 22:41:19 +0000 (00:41 +0200)]
`never_loop`: suggest using an `if let` instead of a `for` loop

2 years agoupdate clippy
Esteban Kuber [Wed, 11 Aug 2021 14:21:33 +0000 (14:21 +0000)]
update clippy

2 years agotree-wide: Fix all the rustdoc warnings
Jade [Fri, 6 Aug 2021 02:46:26 +0000 (19:46 -0700)]
tree-wide: Fix all the rustdoc warnings

2 years agoAdd is_trait_item, refactor or_fun_call and unwrap_or_else_default
Jade [Fri, 6 Aug 2021 03:08:52 +0000 (20:08 -0700)]
Add is_trait_item, refactor or_fun_call and unwrap_or_else_default

2 years agoAdd unwrap_or_else_default lint
Jade [Fri, 30 Jul 2021 06:56:47 +0000 (23:56 -0700)]
Add unwrap_or_else_default lint

This will catch `unwrap_or_else(Default::default)` on Result and Option
and suggest `unwrap_or_default()` instead.

2 years agoAuto merge of #7535 - LeSeulArtichaut:7518-self-ty-arg, r=xFrednet
bors [Tue, 10 Aug 2021 10:25:26 +0000 (10:25 +0000)]
Auto merge of #7535 - LeSeulArtichaut:7518-self-ty-arg, r=xFrednet

Properly handle `Self` type for `trivially_copy_pass_by_ref`

changelog: properly handle `Self` type for [`trivially_copy_pass_by_ref`].

Fixes #7518

2 years agoAuto merge of #7478 - DevinR528:preemtive, r=llogiq
bors [Tue, 10 Aug 2021 00:52:04 +0000 (00:52 +0000)]
Auto merge of #7478 - DevinR528:preemtive, r=llogiq

Fix nonstandard_macro_braces FP and docs of disallowed_types

changelog: Fix FP in [`nonstandard_macro_braces`] lint

2 years agoAuto merge of #7544 - r00ster91:patch-1, r=flip1995
bors [Mon, 9 Aug 2021 14:04:36 +0000 (14:04 +0000)]
Auto merge of #7544 - r00ster91:patch-1, r=flip1995

Clean up examples in new lint suggestion template

I'm pretty sure they meant to write `bounds checking` when they wrote `bounce checking` but I could be wrong. After that I thought I could improve it further and ended up with this.

changelog: none

2 years agoAuto merge of #7542 - LeSeulArtichaut:cleanups, r=flip1995
bors [Mon, 9 Aug 2021 13:48:47 +0000 (13:48 +0000)]
Auto merge of #7542 - LeSeulArtichaut:cleanups, r=flip1995

Cleanup usage of `span_to_snippet` and `LintContext::sess`

- avoid using `SourceMap::span_to_snippet` directly and use `clippy_utils::source::snippet_opt` instead
- don't use `LintContext::sess()` on `EarlyContext`s which have a `sess` field directly available, saving the import of `LintContext`

changelog: none

2 years agoAuto merge of #7506 - HKalbasi:add-xor-swap, r=camsteffen
bors [Mon, 9 Aug 2021 13:34:42 +0000 (13:34 +0000)]
Auto merge of #7506 - HKalbasi:add-xor-swap, r=camsteffen

Add xor case to `manual swap` lint

Continue of #7153
closes #6598

changelog: Add "xor swap" case to [`manual_swap`]

2 years agomerge XOR_SWAP with MANUAL_SWAP
hamidreza kalbasi [Thu, 29 Jul 2021 12:08:17 +0000 (16:38 +0430)]
merge XOR_SWAP with MANUAL_SWAP

2 years agosimilar_names: allow "iter" and "item"
Matthias Geier [Sat, 7 Aug 2021 16:11:49 +0000 (18:11 +0200)]
similar_names: allow "iter" and "item"

2 years agoAuto merge of #7536 - LeSeulArtichaut:redundant-allocation-doc, r=giraffate
bors [Sat, 7 Aug 2021 13:19:06 +0000 (13:19 +0000)]
Auto merge of #7536 - LeSeulArtichaut:redundant-allocation-doc, r=giraffate

Add missing backtick in docs for `redundant_allocation`

changelog: none

2 years agoAuto merge of #7534 - LeSeulArtichaut:7517-closure-too-many-lines, r=flip1995
bors [Sat, 7 Aug 2021 13:05:53 +0000 (13:05 +0000)]
Auto merge of #7534 - LeSeulArtichaut:7517-closure-too-many-lines, r=flip1995

Don't emit `too_many_lines` for closures

changelog: don't emit the [`too_many_lines`] lint inside closures to avoir duplicated diagnostics.

Fixes #7517.

2 years agoAuto merge of #7533 - Valentine-Mario:vec_extend_to_append, r=xFrednet
bors [Sat, 7 Aug 2021 12:54:13 +0000 (12:54 +0000)]
Auto merge of #7533 - Valentine-Mario:vec_extend_to_append, r=xFrednet

fix bug on mutable ref

fixes: #7524

This PR is related to issue #7524
changelog:  [`extend_with_drain`] Improve code suggestion for mutable and immutable references

2 years agoClean up examples in new lint suggestion template
r00ster [Sat, 7 Aug 2021 06:02:25 +0000 (08:02 +0200)]
Clean up examples in new lint suggestion template

2 years agoUse `EarlyContext::sess` instead of `LintContext::sess()`
LeSeulArtichaut [Fri, 6 Aug 2021 23:15:29 +0000 (01:15 +0200)]
Use `EarlyContext::sess` instead of `LintContext::sess()`

2 years agoReplace `span_to_snippet` calls with `snippet_opt` from `clippy_utils`
LeSeulArtichaut [Fri, 6 Aug 2021 23:01:27 +0000 (01:01 +0200)]
Replace `span_to_snippet` calls with `snippet_opt` from `clippy_utils`

2 years agoAdd missing backtick in docs for `redundant_allocation`
LeSeulArtichaut [Thu, 5 Aug 2021 17:06:35 +0000 (19:06 +0200)]
Add missing backtick in docs for `redundant_allocation`

2 years agoProperly handle `Self` type for `trivially_copy_pass_by_ref`
LeSeulArtichaut [Thu, 5 Aug 2021 16:11:08 +0000 (18:11 +0200)]
Properly handle `Self` type for `trivially_copy_pass_by_ref`

2 years agofixed bug that had to deal with mut and non mut suggestion
valentine-mario [Thu, 5 Aug 2021 15:15:44 +0000 (16:15 +0100)]
fixed bug that had to deal with mut and non mut suggestion

2 years agoDon't emit `too_many_lines` for closures
LeSeulArtichaut [Thu, 5 Aug 2021 13:38:57 +0000 (15:38 +0200)]
Don't emit `too_many_lines` for closures

2 years agoAuto merge of #7528 - matthiaskrgr:nedlbrw, r=Manishearth
bors [Wed, 4 Aug 2021 09:17:10 +0000 (09:17 +0000)]
Auto merge of #7528 - matthiaskrgr:nedlbrw, r=Manishearth

needless_borrow: try to make lint example a bit more illustrating

changelog: none

2 years agoAuto merge of #7529 - giraffate:update_node_version, r=flip1995,llogiq
bors [Wed, 4 Aug 2021 09:02:48 +0000 (09:02 +0000)]
Auto merge of #7529 - giraffate:update_node_version, r=flip1995,llogiq

Use node v12.x in CI

In https://github.com/rust-lang/rust-clippy/pull/7528#issuecomment-892281632, remark-cli version has been updated recently and it requires to use ESM module: https://github.com/remarkjs/remark/releases/tag/14.0.0. Node version in CI was v10.24.1, it seems to be old.

changelog: none

2 years agoAddress warnings for remark check
Takayuki Nakata [Wed, 4 Aug 2021 07:22:15 +0000 (16:22 +0900)]
Address warnings for remark check

2 years agoAuto merge of #87568 - petrochenkov:localevel, r=cjgillot
bors [Wed, 4 Aug 2021 02:04:04 +0000 (02:04 +0000)]
Auto merge of #87568 - petrochenkov:localevel, r=cjgillot

rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tables

and passes using those tables - primarily privacy checking, stability checking and dead code checking.

All these passes work with definitions rather than with arbitrary HIR nodes.
r? `@cjgillot`
cc `@lambinoo` (#87487)

2 years agoUse node v12.x in CI
Takayuki Nakata [Wed, 4 Aug 2021 01:27:05 +0000 (10:27 +0900)]
Use node v12.x in CI

2 years agoneedless_borrow: try to make lint example a bit more illustrating
Matthias Krüger [Tue, 3 Aug 2021 22:21:25 +0000 (00:21 +0200)]
needless_borrow: try to make lint example a bit more illustrating

2 years agofixup! Lint inside macro when owned by current crate
Devin Ragotzy [Tue, 3 Aug 2021 12:19:13 +0000 (08:19 -0400)]
fixup! Lint inside macro when owned by current crate

2 years agoAuto merge of #7525 - xFrednet:7172-update-define-conf-macro, r=flip1995
bors [Mon, 2 Aug 2021 20:09:11 +0000 (20:09 +0000)]
Auto merge of #7525 - xFrednet:7172-update-define-conf-macro, r=flip1995

Updated `define_Conf!` to support multi-line doc comments

Updated the `define_Conf!` macro to support multi-line doc comments for readability. This also enables configuration documentation to have multiple paragraphs.

I've also added the `metadata-collector-lint` feature to the CI build and testing tasks. (I would think that we want this, now that we officially switched over)

---

Now a small informal explanation what this PR changes (just for fun):

* *Once upon a time there was a monster. It was handsome, supportive and happy to dig through the best source code it has ever seen. Spanning over hundreds of lines and reading over complete crates, it was purely marvels!*

    *However, there was one region in its territory that wasn't clean and well formatted like the rest. That was the mighty `define_Conf` macro. The monster would have cleaned it up a long time ago but, the previous ruler of this kingdom a powerful Python script was prohibiting it. But now that the old king was slain in the great battle of rust-1.54.0, everything was possible again. Our lovely monster was now able to grab its cleaning equipment and get some nice formatting into the now unprotected area.*

    *Said and done! Let this day go down in history!*

(I'll be the first to admit, that I'm a bit lost today. And I'm also procrastinating on some other discussions where I have some catching up to do... Oh, well, this was fun)

---

changelog: none

r? `@flip1995`

2 years agoAdded the `metadata-collector-lint` feature to the CI
xFrednet [Mon, 2 Aug 2021 15:55:21 +0000 (17:55 +0200)]
Added the `metadata-collector-lint` feature to the CI

2 years agoUpdated `define_Conf!` to support multi-line doc comments
xFrednet [Mon, 2 Aug 2021 15:25:58 +0000 (17:25 +0200)]
Updated `define_Conf!` to support multi-line doc comments

2 years agoAuto merge of #7522 - dswij:map-flatten-result, r=llogiq
bors [Mon, 2 Aug 2021 07:27:09 +0000 (07:27 +0000)]
Auto merge of #7522 - dswij:map-flatten-result, r=llogiq

Cover `Result` on `map_flatten` lint

Closes #7496

changelog: `[map_flatten]` handles `Result` type

2 years agoAuto merge of #87535 - lf-:authors, r=Mark-Simulacrum
bors [Mon, 2 Aug 2021 05:49:17 +0000 (05:49 +0000)]
Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum

rfc3052 followup: Remove authors field from Cargo manifests

Since RFC 3052 soft deprecated the authors field, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information for contributors, we may as well
remove it from crates in this repo.

2 years agoAuto merge of #7519 - Jarcho:rustfmt_fix, r=giraffate
bors [Mon, 2 Aug 2021 00:56:54 +0000 (00:56 +0000)]
Auto merge of #7519 - Jarcho:rustfmt_fix, r=giraffate

Workaround rust-lang/rustfmt#4477 - relative paths in `path` attribute

See rust-lang/rustfmt#4477
changelog: None

2 years agobump bootstrap compiler to 1.55
Pietro Albini [Fri, 30 Jul 2021 12:46:56 +0000 (14:46 +0200)]
bump bootstrap compiler to 1.55

2 years agoHandle `Result` on `map_flatten` lint
Dharma Saputra Wijaya [Sun, 1 Aug 2021 09:47:29 +0000 (17:47 +0800)]
Handle `Result` on `map_flatten` lint

Adds a check on `.map(..).flatten()` on `Result` type that follows the
behaviour on `Option` type.

2 years agoFix clippy
Vadim Petrochenkov [Wed, 28 Jul 2021 22:07:32 +0000 (01:07 +0300)]
Fix clippy

2 years agoAuto merge of #7520 - Jarcho:while_let_7510, r=Manishearth
bors [Sat, 31 Jul 2021 15:15:41 +0000 (15:15 +0000)]
Auto merge of #7520 - Jarcho:while_let_7510, r=Manishearth

Fix `while_let_on_iterator` - #7510

fixes: #7510
changelog: Suggest re-borrowing mutable references in `while_let_on_iterator`

2 years agoFix `while_let_on_iterator`
Jason Newcomb [Sat, 31 Jul 2021 13:32:54 +0000 (09:32 -0400)]
Fix `while_let_on_iterator`
When the iterator is one field within a local correctly check for usages of the field

2 years agoFix `while_let_on_iterator`
Jason Newcomb [Sat, 31 Jul 2021 02:59:20 +0000 (22:59 -0400)]
Fix `while_let_on_iterator`
Reborrow mutable references rather then take a reference to them.

2 years agoWorkaround rust-lang/rustfmt#4477 - relative paths in `path` attribute
Jason Newcomb [Sat, 31 Jul 2021 03:43:04 +0000 (23:43 -0400)]
Workaround rust-lang/rustfmt#4477 - relative paths in `path` attribute

2 years agoAuto merge of #86754 - estebank:use-multispans-more, r=varkor
bors [Fri, 30 Jul 2021 23:18:12 +0000 (23:18 +0000)]
Auto merge of #86754 - estebank:use-multispans-more, r=varkor

Use `multipart_suggestions` more

Built on top of #86532

2 years agoRollup merge of #87385 - Aaron1011:final-enable-semi, r=petrochenkov
Yuki Okushi [Fri, 30 Jul 2021 19:09:20 +0000 (04:09 +0900)]
Rollup merge of #87385 - Aaron1011:final-enable-semi, r=petrochenkov

Make `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` warn by default

This PR makes the `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint warn by default.

To avoid showing a large number of un-actionable warnings to users, we only enable the lint for macros defined in the same crate. This ensures that users will be able to fix the warning by simply removing a semicolon.

In the future, I'd like to enable this lint unconditionally, and eventually make it into a hard error in a future edition. This PR is a step towards that goal.

2 years agoUse multispan suggestions more often
Esteban Küber [Mon, 28 Jun 2021 18:22:47 +0000 (11:22 -0700)]
Use multispan suggestions more often

* Use more accurate span for `async move` suggestion
* Use more accurate span for deref suggestion
* Use `multipart_suggestion` more often

2 years agorfc3052: Remove authors field from Cargo manifests
Jade [Tue, 27 Jul 2021 23:38:13 +0000 (16:38 -0700)]
rfc3052: Remove authors field from Cargo manifests

Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.

2 years agoRemove unnecessary trailing semicolons from clippy tests
Aaron Hill [Thu, 29 Jul 2021 14:52:35 +0000 (09:52 -0500)]
Remove unnecessary trailing semicolons from clippy tests

2 years agoAuto merge of #7509 - xFrednet:patch-1, r=flip1995
bors [Thu, 29 Jul 2021 14:44:46 +0000 (14:44 +0000)]
Auto merge of #7509 - xFrednet:patch-1, r=flip1995

Updated config value name in change log for 1.54

Hey, I've noticed that the change log for 1.54 references the avoid_breaking_exported_api configuration with its Rust name, not the name it actually has in the config file. This should fix it for everyone, as the blog post references our change log on the master branch. Just a very small PR xD

changelog: none

(This is the change log xD)

r? `@flip1995`

2 years agoUpdated config value name in changelog for 1.54
Fridtjof Stoldt [Thu, 29 Jul 2021 14:26:26 +0000 (16:26 +0200)]
Updated config value name in changelog for 1.54

2 years agoAuto merge of #7507 - LeSeulArtichaut:patch-1, r=flip1995
bors [Thu, 29 Jul 2021 12:41:52 +0000 (12:41 +0000)]
Auto merge of #7507 - LeSeulArtichaut:patch-1, r=flip1995

Remove `or_patterns` feature gate in example

changelog: removed `or_patterns` feature gate in the code example for the [`unnested_or_patterns`] lint

2 years agoRemove `or_patterns` feature gate in example
Léo Lanteri Thauvin [Thu, 29 Jul 2021 12:23:12 +0000 (14:23 +0200)]
Remove `or_patterns` feature gate in example

2 years agoAuto merge of #7498 - xFrednet:changelog-1-55, r=flip1995
bors [Thu, 29 Jul 2021 12:03:04 +0000 (12:03 +0000)]
Auto merge of #7498 - xFrednet:changelog-1-55, r=flip1995

Updated changelog for 1.55

This has again been a bit of work, but I'm happy to notice that my English is still improving, and I'm getting faster at these things. That's a very nice side effect of contributing and getting feedback on reviews :blush:

Moving on, there were a few things that I was unsure about:
* The PR rust-lang/rust#86717 changes an old entry in the change log, is this worth mentioning? I've left it out for now.
* The stabilization of `cargo clippy --fix` is quite awesome and important IMO. It sadly gets a bit lost in the *Other* entry, as it's the last one. Do we maybe want to move it somewhere else or change the headline order for this release?
* I've listed the introduction of the new `suspicious` group under the *Moves and Deprecations* section. Is this alright, or should it be moved to the *Other* section as well?
* Last but definitely not least, some fun! I've used the :tada: emoji in the `cargo clippy --fix` entry, is this okay?

Sorry for the bombardment of questions xD

---

The PR already includes the entries for the new metadata collection and website updates. These are not merged yet, but should probably be to make this correct. This might also require the commit hashes to be updated (Not sure on this, though). It would actually be super fitting to get this into this release as we also stabilize `--fix`. TODOs:
* [x] Merge metadata collection PRs:
  1. #7279
  2. #7298
  3. #7420 (Hope to not get any merge conflicts)

---

[Rendered :newspaper:](https://github.com/xFrednet/rust-clippy/blob/changelog-1-55/CHANGELOG.md)

r? `@flip1995`

changelog: none

2 years agoUpdated changelog for 1.55
xFrednet [Tue, 27 Jul 2021 22:44:24 +0000 (00:44 +0200)]
Updated changelog for 1.55

Co-authored-by: Philipp Krones <hello@philkrones.com>
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2 years agoadd xor-swap lint
Hrishi Dharam [Sun, 2 May 2021 16:42:28 +0000 (12:42 -0400)]
add xor-swap lint

2 years agoMerge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup
flip1995 [Thu, 29 Jul 2021 10:16:06 +0000 (12:16 +0200)]
Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup

2 years agoAuto merge of #7504 - flip1995:rename-lints, r=flip1995
bors [Thu, 29 Jul 2021 10:14:31 +0000 (10:14 +0000)]
Auto merge of #7504 - flip1995:rename-lints, r=flip1995

Rename two lints to comply with our lint naming convention

self_named_constructor -> self_named_constructors
append_instead_of_extend -> extend_with_drain

We don't need to `register_renamed` those lints, since I'll backport them to beta, so the old names won't hit stable.

changelog: none
(I'll adapt the changelog before merging #7498)

2 years agoRename two lints to comply with our lint naming convention
flip1995 [Thu, 29 Jul 2021 10:10:18 +0000 (12:10 +0200)]
Rename two lints to comply with our lint naming convention

self_named_constructor -> self_named_constructors
append_instead_of_extend -> extend_with_drain

2 years agoAuto merge of #7503 - flip1995:rustup, r=flip1995
bors [Thu, 29 Jul 2021 09:35:13 +0000 (09:35 +0000)]
Auto merge of #7503 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump Clippy Version -> 0.1.56
flip1995 [Thu, 29 Jul 2021 09:15:11 +0000 (11:15 +0200)]
Bump Clippy Version -> 0.1.56

2 years agoBump nightly version -> 2021-07-29
flip1995 [Thu, 29 Jul 2021 09:14:53 +0000 (11:14 +0200)]
Bump nightly version -> 2021-07-29

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

2 years agoAuto merge of #7502 - flip1995:rollup-y3ho3w0, r=flip1995
bors [Wed, 28 Jul 2021 13:15:43 +0000 (13:15 +0000)]
Auto merge of #7502 - flip1995:rollup-y3ho3w0, r=flip1995

Rollup of 3 pull requests

Successful merges:

 - #7279 (Adapting the lint list to Clippy's new metadata format)
 - #7298 (Switch CI to new metadata collection)
 - #7420 (Update lint documentation to use markdown headlines)

Failed merges:

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

changelog: rollup

2 years agoRollup merge of #7420 - xFrednet:7172-update-lint-documentation, r=flip1995
Philipp Krones [Wed, 28 Jul 2021 13:06:27 +0000 (15:06 +0200)]
Rollup merge of #7420 - xFrednet:7172-update-lint-documentation, r=flip1995

Update lint documentation to use markdown headlines

This PR updates all lint documentation to use markdown headlines. It additionally removed the *Known problems* section for lints without any problems. I've double-checked all automatic replacements, but a second pair of eyes is definitely appreciated!

I wasn't sure when you wanted to switch to the new metadata collection tomorrow, I therefore prepared this PR today. And that's it this is a standalone PR to keep the other related PRs reviewable.

changelog:  none

r? `@flip1995`

cc: #7172

Note: This should be merged with the other metadata collection related PRs.

2 years agoRollup merge of #7298 - flip1995:ci-switch-to-monster, r=xFrednet,flip1995
Philipp Krones [Wed, 28 Jul 2021 13:06:26 +0000 (15:06 +0200)]
Rollup merge of #7298 - flip1995:ci-switch-to-monster, r=xFrednet,flip1995

Switch CI to new metadata collection

r? `@xFrednet`

Things we have to keep in mind:

- This removes the template files and the scripts used for deployment from the checkout. This was added in #5517. I don't think we ever needed those there. Not sure though.
- ~~As a result, we can't remove the python scripts yet. We have to wait until this hits a stable Clippy release.~~ I'll just break the next stable deploy and do it by hand once.
- This should be merged together with #7279. Me and `@xFrednet` will coordinate the switch
- ...?

I still have to try out some things:

- [x] Is it worth caching? Yes
- [x] ~~Is it worth to do a release build?~~ Nope
- [x] Does it actually work? With a few changes, yes
- [ ] ...?

changelog: Clippy now uses a lint to generate its documentation :tada:

2 years agoRollup merge of #7279 - xFrednet:7172-adapt-website-to-new-format, r=flip1995
Philipp Krones [Wed, 28 Jul 2021 13:06:26 +0000 (15:06 +0200)]
Rollup merge of #7279 - xFrednet:7172-adapt-website-to-new-format, r=flip1995

Adapting the lint list to Clippy's new metadata format

This is close to the end of a long living project to rewrite the lint metadata collection for Clippy. Progress on this has been tracked in #7172. This PR adds one of the last missing puzzle pieces, the actual display of all the changes that have been done in the background. A preview can be seen here: [Clippy's lint list](https://xfrednet.github.io/rust-clippy/master/index.html)

The styling has been discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Styling.20feedback.20for.20Clippy's.20lint.20list/near/239601067) but is still open to suggestion.

Side note: It has been fun working on the website where we don't have unit tests and everything is just tested by playing around. However, it's good that this chaos is contained into this one part of Clippy. :bug:

---

Closes: #1303
Closes: #4310
This actually closes fewer things than I thought it would...

changelog: Reworked Clippy's [website](https://rust-lang.github.io/rust-clippy/master/index.html):
changelog: * Added applicability information about lints
changelog: * Added a link to jump to the specific lint implementation
changelog: * Adapted some styling and improved loading time

r? `@flip1995`

2 years agoRun cargo collect-metadata in cargo dev serve
flip1995 [Wed, 28 Jul 2021 13:05:11 +0000 (15:05 +0200)]
Run cargo collect-metadata in cargo dev serve