]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #7593 - camsteffen:remove-stderr-limit, r=Manishearth
bors [Mon, 23 Aug 2021 16:14:50 +0000 (16:14 +0000)]
Auto merge of #7593 - camsteffen:remove-stderr-limit, r=Manishearth

Remove stderr limit

changelog: none

Discussed at https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Increase.20test.20stderr.20length.20limit.3F

2 years agoRemove stderr limit
Cameron Steffen [Mon, 23 Aug 2021 15:58:56 +0000 (10:58 -0500)]
Remove stderr limit

2 years agoAuto merge of #7539 - Labelray:master, r=camsteffen
bors [Mon, 23 Aug 2021 13:56:18 +0000 (13:56 +0000)]
Auto merge of #7539 - Labelray:master, r=camsteffen

Add new lint `negative_feature_names` and `redundant_feature_names`

Add new lint [`negative_feature_names`] to detect feature names with prefixes `no-` or `not-` and new lint [`redundant_feature_names`] to detect feature names with prefixes `use-`, `with-` or suffix `-support`
changelog: Add new lint [`negative_feature_names`] and [`redundant_feature_names`]

2 years agoAdd new lints `negative_feature_names` and `redundant_feature_names`
Labelray [Fri, 6 Aug 2021 14:46:20 +0000 (22:46 +0800)]
Add new lints `negative_feature_names` and `redundant_feature_names`

2 years agoAuto merge of #7565 - Jarcho:manual_split_once, r=llogiq
bors [Tue, 17 Aug 2021 21:15:48 +0000 (21:15 +0000)]
Auto merge of #7565 - Jarcho:manual_split_once, r=llogiq

New lint `manual_split_once`

This is a WIP because it still needs to recognize more patterns. Currently handles:

```rust
s.splitn(2, ' ').next();
s.splitn(2, ' ').nth(0)
s.splitn(2, ' ').nth(1);
s.splitn(2, ' ').skip(0).next();
s.splitn(2, ' ').skip(1).next();
s.splitn(2, ' ').next_tuple(); // from itertools

// as well as `unwrap()` and `?` forms
```

Still to do:

```rust
let mut iter = s.splitn(2, ' ');
(iter.next().unwrap(), iter.next()?)

let mut iter = s.splitn(2, ' ');
let key = iter.next().unwrap();
let value = iter.next()?;
```

Suggestions on other patterns to check for would be useful. I've done a search on github for uses of `splitn`. Still have yet to actually look through the results.

There's also the question of whether the lint shouold trigger on all uses of `splitn` with two values, or only on recognized usages. The former could have false positives where it couldn't be replaced, but I'm not sure how common that would be.

changelog: Add lint `manual_split_once`

2 years agoAuto merge of #7578 - xFrednet:7172-update-some-docs, r=camsteffen
bors [Tue, 17 Aug 2021 17:55:28 +0000 (17:55 +0000)]
Auto merge of #7578 - xFrednet:7172-update-some-docs, r=camsteffen

Small documentation update for the new metadata_collector

Just small documentation updates after the merge of the new metadata collection. I'm also here to deliver on the promised fairy tale:

*Once upon a time, there was a world with many languages. One of the oldest was C a very versatile language that gave great power for the cost of great complexity and manual work. C was so powerful that it was able to create new languages. There is Java a versatile language often used by companies and in formal settings. Python that focused on readability and rapid prototyping capabilities. JavaScript which has some interesting edge cases but was still loved and widely used in the world. Together they build the foundation of our world and continue to shape the interactions between kingdoms worldwide.*

*C ruled as the king of Linux and other operating systems alongside the Queen C++. Together they were powerful leaders, in fact so powerful that they have been ruling this world for over 49 years. They remain happy together and loved by the community. However, with great power comes great responsibility! The two of them have a dark secret. To tell the truth, they sometimes suffer from memory loss and even worse in some instances from race conditions.*

*A mystical creature called Firefox lead to the creation of Mozilla, a global organization fighting for privacy and for their market share in the browser marked. As part of this fight, they started to modify parts of Firefox and eventually created Servo. A completely new creature with a new language called Rust. This new form of communication was focussed on correctness, speed and a new model of memory management.*

*Rust grew up over several years with modification to syntax, content among other things. Finally, in 2015 Rust has reached adulthood which enabled it to take part in the global discourse and shape the future of our world. Some even say that this was the start of a new area withing language design.*

*Rust had already started to build its kingdom and was now the head of a complete organization, with teams being in charge of individual tools used for further development. One team focussing on further improving Rust when it comes to complexity, style and performance was **The Clippy Team**. Its members were a friendly bunch, with mages and wizards among them.*

*With the goal of giving more power to Rust, they identified a Python tool inside Clippy that could be rewritten. This led to the creating of the **Metadata collection monster**. This monster soon replaced the old Python tool and allowed for new creative additions inside Clippy's lint list. With the eradication of the old tool, there came a possibility to update the configuration documentation to span over a lager area. This was done, but some doc comments remained until now in memory of the old tool. This is now the PR that removes these doc comments.*

---

I have to stop now, this already took way longer than the actual changes. It probably also contains some spelling mistakes, but oh well. I hope you get the gist of it :upside_down_face:.

---

r? `@camsteffen`

changelog: none

2 years agoSmall documentation update for the new metadata_collector
xFrednet [Tue, 17 Aug 2021 12:51:56 +0000 (14:51 +0200)]
Small documentation update for the new metadata_collector

2 years agoAuto merge of #7574 - Jarcho:expl_impl_clone_on_copy_doc, r=giraffate
bors [Tue, 17 Aug 2021 00:23:43 +0000 (00:23 +0000)]
Auto merge of #7574 - Jarcho:expl_impl_clone_on_copy_doc, r=giraffate

Update docs for `expl_impl_clone_on_copy`

The known issue was fixed in #6993. I missed updating the docs then, so it's happening now.

changelog: None

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 agoUpdate docs for `manual_split_once`
Jason Newcomb [Sun, 15 Aug 2021 20:27:59 +0000 (16:27 -0400)]
Update docs for `manual_split_once`

2 years agoAdd lint `manual_split_once`
Jason Newcomb [Sat, 17 Jul 2021 17:52:03 +0000 (13:52 -0400)]
Add lint `manual_split_once`

2 years agoAdd `for_each_local_usage`. Switch `LocalUsedVisitor` to a function.
Jason Newcomb [Mon, 7 Jun 2021 00:01:14 +0000 (20:01 -0400)]
Add `for_each_local_usage`. Switch `LocalUsedVisitor` to a function.

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