]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoSplit unfixable lints.
Allen Hsu [Wed, 13 Jul 2022 11:25:19 +0000 (21:25 +1000)]
Split unfixable lints.

23 months agoCompare where predicates to trait bounds.
Allen Hsu [Tue, 12 Jul 2022 12:29:12 +0000 (22:29 +1000)]
Compare where predicates to trait bounds.

- only compare where predicates to trait bounds when generating where
  clause specific message to fix #9151
- use comparable_trait_ref to account for trait bound generics to fix #8757

23 months agoAuto merge of #9241 - Jarcho:ice_9238, r=xFrednet
bors [Mon, 25 Jul 2022 22:14:55 +0000 (22:14 +0000)]
Auto merge of #9241 - Jarcho:ice_9238, r=xFrednet

Fix ICE in `miri_to_const`

fixes #9238
changelog: Fix ICE when using `#![feature(generic_const_exprs)]` in various lints

23 months agoAuto merge of #9130 - c410-f3r:arith, r=llogiq
bors [Mon, 25 Jul 2022 21:26:15 +0000 (21:26 +0000)]
Auto merge of #9130 - c410-f3r:arith, r=llogiq

Add `Arithmetic` lint

Fixes https://github.com/rust-lang/rust-clippy/issues/8903

r? `@llogiq`

changelog: Add `Arithmetic` lint

23 months agoAuto merge of #9243 - Jarcho:std_core, r=Manishearth
bors [Mon, 25 Jul 2022 15:19:41 +0000 (15:19 +0000)]
Auto merge of #9243 - Jarcho:std_core, r=Manishearth

Don't lint `std_instead_of_core` on `std::env`

fixes #9239

This also reorders the execution of the lint to do as little as possible in the case where the path doesn't start with `std` or `alloc`.

changelog: [`std_instead_of_core`](https://rust-lang.github.io/rust-clippy/master/#std_instead_of_core): Don't lint on `use std::env`
changelog: [`std_instead_of_alloc`](https://rust-lang.github.io/rust-clippy/master/#std_instead_of_alloc): Don't lint `use std::vec` twice

23 months agoAuto merge of #9225 - tabokie:assert_ok, r=Jarcho
bors [Mon, 25 Jul 2022 15:00:27 +0000 (15:00 +0000)]
Auto merge of #9225 - tabokie:assert_ok, r=Jarcho

add `[assertions_on_result_states]` lint

Close #9162

changelog: add `[assertions_on_result_states]` lint

Signed-off-by: tabokie <xy.tao@outlook.com>
23 months agoAdd `[assertions_on_result_states]` lint
tabokie [Fri, 22 Jul 2022 05:17:10 +0000 (13:17 +0800)]
Add `[assertions_on_result_states]` lint

Signed-off-by: tabokie <xy.tao@outlook.com>
23 months agoAuto merge of #9246 - kyoto7250:reopen_issue_8493, r=Jarcho
bors [Mon, 25 Jul 2022 14:26:27 +0000 (14:26 +0000)]
Auto merge of #9246 - kyoto7250:reopen_issue_8493, r=Jarcho

check macro statements in `[non_copy_const]`

close #8493
close #9224

This PR fixes false positives in `[non_copy_const]`.

changelog: fix false positives in`[non_copy_const]`

---

r? `@Jarcho`

23 months agofixed tests to not use tokio
kyoto7250 [Mon, 25 Jul 2022 14:04:18 +0000 (23:04 +0900)]
fixed tests to not use tokio

23 months agocheck macro statements in non_copy_const.rs
kyoto7250 [Mon, 25 Jul 2022 12:41:12 +0000 (21:41 +0900)]
check macro statements in non_copy_const.rs

23 months agoAuto merge of #9245 - alex-semenyuk:enable_multiple_config_files_on_windows, r=Alexendoo
bors [Mon, 25 Jul 2022 12:24:41 +0000 (12:24 +0000)]
Auto merge of #9245 - alex-semenyuk:enable_multiple_config_files_on_windows, r=Alexendoo

Enable test multiple_config_files on windows

Verified that it actully works on windows
changelog: none

2 years agoEnable test multiple_config_files on windows
alex-semenyuk [Mon, 25 Jul 2022 10:57:26 +0000 (13:57 +0300)]
Enable test multiple_config_files on windows

2 years agoAuto merge of #9244 - Jarcho:ice-9242, r=flip1995
bors [Mon, 25 Jul 2022 08:12:15 +0000 (08:12 +0000)]
Auto merge of #9244 - Jarcho:ice-9242, r=flip1995

Fix ICE in `question_mark`

fixes #9242
changelog: [`question_mark`](https://rust-lang.github.io/rust-clippy/master/#question_mark): Fix ICE on zero field tuple structs

2 years agoImprove `[std|alloc]_instead_of_[alloc|core]` lints
Jason Newcomb [Mon, 25 Jul 2022 00:17:55 +0000 (20:17 -0400)]
Improve `[std|alloc]_instead_of_[alloc|core]` lints
* Don't call `TyCtxt::crate_name` unless necessary
* Don't lint on `use std::env`
* Only lint once on `use std::vec`

2 years agoFix ICE in `question_mark`
Jason Newcomb [Mon, 25 Jul 2022 03:12:29 +0000 (23:12 -0400)]
Fix ICE in `question_mark`

2 years agoFix ICE in `miri_to_const`
Jason Newcomb [Sun, 24 Jul 2022 22:23:33 +0000 (18:23 -0400)]
Fix ICE in `miri_to_const`

2 years agoAuto merge of #9237 - Alexendoo:useless-format-spans, r=Jarcho
bors [Sun, 24 Jul 2022 17:21:15 +0000 (17:21 +0000)]
Auto merge of #9237 - Alexendoo:useless-format-spans, r=Jarcho

Fix `useless_format` spans for `format!("{foo}")`

Fixes #9234

changelog: [`useless_format`]: Fix spans for `format!("{foo}")`

https://github.com/rust-lang/rust/pull/94030 made our workaround unneeded, but by coincidence our test still passed [because `Span::new()` swaps `hi` & `lo` if needed](https://github.com/rust-lang/rust/blob/c32dcbba187d1ee0dbe92dc152cb9c2f3f42900c/compiler/rustc_span/src/span_encoding.rs#L86-L88). So with a single character variable like `format!("{x}")` it still worked

2 years agoFix `useless_format` spans for `format!("{foo}")`
Alex Macleod [Sun, 24 Jul 2022 16:37:08 +0000 (16:37 +0000)]
Fix `useless_format` spans for `format!("{foo}")`

2 years agoAuto merge of #9235 - alex-semenyuk:fixing_guide_link, r=llogiq
bors [Sun, 24 Jul 2022 11:49:22 +0000 (11:49 +0000)]
Auto merge of #9235 - alex-semenyuk:fixing_guide_link, r=llogiq

Fix src link

changelog: none

2 years agoFix src link
alexey semenyuk [Sun, 24 Jul 2022 08:22:50 +0000 (11:22 +0300)]
Fix src link

2 years agoAuto merge of #9230 - RalfJung:fix-doc-lint-names, r=Alexendoo
bors [Sat, 23 Jul 2022 13:05:21 +0000 (13:05 +0000)]
Auto merge of #9230 - RalfJung:fix-doc-lint-names, r=Alexendoo

fix outdated lint names in docs

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

changelog: fix outdated lint names in "as_conversions" documentation

2 years agofix outdated lint names in docs
Ralf Jung [Sat, 23 Jul 2022 12:36:26 +0000 (08:36 -0400)]
fix outdated lint names in docs

2 years agoAuto merge of #9229 - FoseFx:case_sensitive_file_extension_comparisons_doc, r=dswij
bors [Sat, 23 Jul 2022 11:59:19 +0000 (11:59 +0000)]
Auto merge of #9229 - FoseFx:case_sensitive_file_extension_comparisons_doc, r=dswij

Update case_sensitive_file_extension_comparisons example

Closing #9220

changelog: [`case_sensitive_file_extension_comparisons`]: update example

2 years agoupdate case_sensitive_file_extension_comparisons example
Max Baumann [Fri, 22 Jul 2022 14:39:45 +0000 (16:39 +0200)]
update case_sensitive_file_extension_comparisons example
The old example does not work in case the delimiter is not in the name

Co-authored-by: flip1995 <9744647+flip1995@users.noreply.github.com>
2 years agoAuto merge of #9214 - Jarcho:assign_op_prim, r=Manishearth
bors [Thu, 21 Jul 2022 17:00:40 +0000 (17:00 +0000)]
Auto merge of #9214 - Jarcho:assign_op_prim, r=Manishearth

Check `assign_op_pattern` for conflicting borrows

fixes #9180

changelog: [`assign_op_pattern`](https://rust-lang.github.io/rust-clippy/master/#assign_op_pattern): Don't lint when the suggestion would cause borrowck errors.

2 years agoAuto merge of #9215 - alex-semenyuk:enable_test_entrypoint_recursion, r=Jarcho
bors [Thu, 21 Jul 2022 15:45:50 +0000 (15:45 +0000)]
Auto merge of #9215 - alex-semenyuk:enable_test_entrypoint_recursion, r=Jarcho

Enable test for entrypoint_recursion for windows

Verified that this test actually works on windows
changelog: none

2 years agoAuto merge of #9216 - smoelius:master, r=flip1995
bors [Thu, 21 Jul 2022 07:58:27 +0000 (07:58 +0000)]
Auto merge of #9216 - smoelius:master, r=flip1995

Add `ui_cargo_toml_metadata` test

This PR adds a test to check the metadata of packages in the `ui_cargo` directory.

A recent change to Cargo causes it to warn when it finds multiple packages with the same name in a git dependency (the issue is described [here](https://github.com/rust-lang/cargo/issues/10752)).

Many (if  not all) Dylint libraries depend upon `clippy_utils`. As a result of the change, one now sees the following when building a Dylint library:
```
warning: skipping duplicate package `fail` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/module_style/pass_mod`
warning: skipping duplicate package `fail` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/module_style/fail_no_mod`
warning: skipping duplicate package `cargo_common_metadata` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_common_metadata/fail_publish_true`
warning: skipping duplicate package `fail-cargo` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/pass_cargo`
warning: skipping duplicate package `fail-clippy` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/fail_clippy`
warning: skipping duplicate package `fail-both-same` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/fail_both_same`
warning: skipping duplicate package `fail-file-attr` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/fail_file_attr`
```
There appear to be two contributing factors:
- Some packages in `ui_cargo` could have a `publish = false` added to them.
- Some packages in `ui_cargo` seem to be inconsistently named.

The new test checks that each package in the `ui_cargo` directory has a name matching one of its parent directories, and `publish = false` in its metadata (with a few exceptions).

Note that the packages in `cargo_common_metadata` require special care because `publish` is the subject of some of the `cargo_common_metadata` tests.

Also note that this PR adds `walkdir` as a dev dependency to the `clippy` package. However, it was already a dependency of `clippy_dev` and `lintcheck`. So hopefully this is acceptable.

Our continued thanks for making `clippy_utils` available, BTW. :)

r? `@flip1995`

changelog: none

2 years agoAuto merge of #9217 - Serial-ATA:extra-newlines, r=giraffate
bors [Thu, 21 Jul 2022 06:04:43 +0000 (06:04 +0000)]
Auto merge of #9217 - Serial-ATA:extra-newlines, r=giraffate

Remove extra newlines in [`significant_drop_in_scrutinee`] docs

changelog: none

2 years agoRemove extra newlines in [`significant_drop_in_scrutinee`] docs
Serial [Thu, 21 Jul 2022 01:35:11 +0000 (21:35 -0400)]
Remove extra newlines in [`significant_drop_in_scrutinee`] docs

2 years agoEnable test for entrypoint_recursion for windows
alex-semenyuk [Wed, 20 Jul 2022 18:41:12 +0000 (21:41 +0300)]
Enable test for entrypoint_recursion for windows

2 years agoDon't lint `assign_op_pattern` when the suggestion would cause borrowck errors
Jason Newcomb [Wed, 20 Jul 2022 14:00:04 +0000 (10:00 -0400)]
Don't lint `assign_op_pattern` when the suggestion would cause borrowck errors

2 years agoAuto merge of #9207 - Jarcho:todo_arm, r=giraffate
bors [Wed, 20 Jul 2022 01:38:00 +0000 (01:38 +0000)]
Auto merge of #9207 - Jarcho:todo_arm, r=giraffate

Check for `todo!` on every expression in `SpanlessEq`

fixes #9204
changelog: [`match_same_arms`](https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms): Don't lint on arms with `todo!`

2 years agoAuto merge of #9210 - evantypanski:issue9160, r=Manishearth
bors [Tue, 19 Jul 2022 21:16:34 +0000 (21:16 +0000)]
Auto merge of #9210 - evantypanski:issue9160, r=Manishearth

Fix suggestion causing error for [`needless_borrow`] function in field

Fixes #9160

changelog: [`needless_borrow`]: Fix suggestion removing parens from calling a field

2 years agoUse parens around [`needless_borrow`] field calls
Evan Typanski [Tue, 19 Jul 2022 19:17:24 +0000 (15:17 -0400)]
Use parens around [`needless_borrow`] field calls

2 years agoCheck for `todo!` on every expression in `SpanlessEq`
Jason Newcomb [Tue, 19 Jul 2022 13:53:00 +0000 (09:53 -0400)]
Check for `todo!` on every expression in `SpanlessEq`

2 years agoAdd Arithmetic lint
Caio [Mon, 18 Jul 2022 17:29:45 +0000 (14:29 -0300)]
Add Arithmetic lint

2 years agoAuto merge of #9202 - PaulTheNeko:patch-1, r=Manishearth
bors [Mon, 18 Jul 2022 16:10:06 +0000 (16:10 +0000)]
Auto merge of #9202 - PaulTheNeko:patch-1, r=Manishearth

Fix typo in alloc_instead_of_core

The description previously claimed it ensures items are imported from alloc, to ensure a crate won't require alloc, which can't be true.

I'm not sure know how to better phrase the changelog entry below.

changelog: [`alloc_instead_of_core`]: fixed typo in description

2 years agoFix typo in alloc_instead_of_core
Paul [Mon, 18 Jul 2022 14:24:30 +0000 (16:24 +0200)]
Fix typo in alloc_instead_of_core

The description previously claimed it ensures items are imported from alloc, to ensure a crate won't require alloc, which can't be true.

2 years agoAuto merge of #9148 - arieluy:then_some_unwrap_or, r=Jarcho
bors [Mon, 18 Jul 2022 12:45:11 +0000 (12:45 +0000)]
Auto merge of #9148 - arieluy:then_some_unwrap_or, r=Jarcho

Add new lint `obfuscated_if_else`

part of #9100, additional commits could make it work with `then` and `unwrap_or_else` as well

changelog: Add new lint `obfuscated_if_else`

2 years agoAuto merge of #9199 - Xiretza:unused-self-exported-api, r=Jarcho
bors [Mon, 18 Jul 2022 12:29:22 +0000 (12:29 +0000)]
Auto merge of #9199 - Xiretza:unused-self-exported-api, r=Jarcho

unused_self: respect avoid-breaking-exported-api

```
changelog: [`unused_self`]: Now respects the `avoid-breaking-exported-api` config option
```

Fixes #9195.

I mostly copied the implementation from `unnecessary_wraps`, since I don't have much understanding of rustc internals.

2 years agoAuto merge of #9146 - arieluy:type_params, r=dswij
bors [Mon, 18 Jul 2022 10:13:39 +0000 (10:13 +0000)]
Auto merge of #9146 - arieluy:type_params, r=dswij

Fix `mismatching_type_param_order` false positive

changelog: Don't lint `mismatching_type_param_order` on complicated generic params

fixes #8962

2 years agounused_self: respect avoid-breaking-exported-api
Xiretza [Mon, 18 Jul 2022 08:36:48 +0000 (10:36 +0200)]
unused_self: respect avoid-breaking-exported-api

2 years agoAuto merge of #9176 - JoelMon:patch-1, r=flip1995
bors [Mon, 18 Jul 2022 07:46:30 +0000 (07:46 +0000)]
Auto merge of #9176 - JoelMon:patch-1, r=flip1995

Rephrased text to remove passive voice for a more active one.

changelog: none

2 years agoRephrased text to remove passive voice for a more active one.
Joel Montes de Oca [Thu, 14 Jul 2022 14:20:08 +0000 (10:20 -0400)]
Rephrased text to remove passive voice for a more active one.

Co-authored-by: Alex <69764315+Serial-ATA@users.noreply.github.com>
2 years agoAdd `ui_cargo_toml_metadata` test
Samuel E. Moelius III [Sun, 17 Jul 2022 22:10:01 +0000 (18:10 -0400)]
Add `ui_cargo_toml_metadata` test

2 years agoAdd new lint `obfuscated_if_else`
Ariel Uy [Sun, 10 Jul 2022 21:37:38 +0000 (14:37 -0700)]
Add new lint `obfuscated_if_else`

New lint suggests using `if .. else ..` instead of
`.then_some(..).unwrap_or(..)`.

2 years agoAuto merge of #9196 - alex-semenyuk:invalid_regex, r=Jarcho
bors [Sun, 17 Jul 2022 23:08:04 +0000 (23:08 +0000)]
Auto merge of #9196 - alex-semenyuk:invalid_regex, r=Jarcho

Fix example for `clippy::invalid_regex`

Close #9194
changelog: previous example doesn't trigger lint

2 years agoFix example for `clippy::invalid_regex`
alexey semenyuk [Sun, 17 Jul 2022 21:35:34 +0000 (00:35 +0300)]
Fix example for `clippy::invalid_regex`

2 years agoFix `mismatching_type_param_order` false positive
Ariel Uy [Sun, 10 Jul 2022 16:39:36 +0000 (09:39 -0700)]
Fix `mismatching_type_param_order` false positive

Previously was giving false positive when an impl had a nontrivial
generic argument such as a tuple. Don't lint on these cases.

2 years agoAuto merge of #9022 - alex-semenyuk:needless_option_take_more_docs, r=Jarcho
bors [Sun, 17 Jul 2022 13:33:40 +0000 (13:33 +0000)]
Auto merge of #9022 - alex-semenyuk:needless_option_take_more_docs, r=Jarcho

`NEEDLESS_OPTION_TAKE` doc improvements

changelog: More info on `NEEDLESS_OPTION_TAKE`

2 years agoNEEDLESS_OPTION_TAKE doc improvements
alexey semenyuk [Sun, 19 Jun 2022 14:15:14 +0000 (14:15 +0000)]
NEEDLESS_OPTION_TAKE doc improvements

NEEDLESS_OPTION_TAKE doc improvements

NEEDLESS_OPTION_TAKE doc improvements

NEEDLESS_OPTION_TAKE doc improvements

NEEDLESS_OPTION_TAKE doc improvements

NEEDLESS_OPTION_TAKE doc improvements

NEEDLESS_OPTION_TAKE doc improvements

NEEDLESS_OPTION_TAKE doc improvements

2 years agoAuto merge of #9171 - Serial-ATA:highlight-js, r=xFrednet
bors [Sat, 16 Jul 2022 20:02:44 +0000 (20:02 +0000)]
Auto merge of #9171 - Serial-ATA:highlight-js, r=xFrednet

Update highlight.js

changelog: none

With [highlight.js v11.6.0](https://github.com/highlightjs/highlight.js/releases/tag/11.6.0), the lint list can finally update from `9.5.0`. No more EOL warning in console! :smile:

I also made it switch to the `github-dark` theme when using `coal`, instead of just always using the normal github light theme.

r? `@xFrednet`

2 years agoAuto merge of #9172 - Guilherme-Vasconcelos:master, r=flip1995
bors [Fri, 15 Jul 2022 16:04:30 +0000 (16:04 +0000)]
Auto merge of #9172 - Guilherme-Vasconcelos:master, r=flip1995

Rename rustcSource in contributing documentation

According to [rust-analyzer docs](https://rust-analyzer.github.io/manual.html#toolchain:~:text=rust%2Danalyzer.rustc.source), rustcSource has been renamed to rustc.source.

changelog: none

2 years agoRename rustcSource in contributing docs
Guilherme-Vasconcelos [Wed, 13 Jul 2022 00:06:10 +0000 (21:06 -0300)]
Rename rustcSource in contributing docs

2 years agoAuto merge of #9178 - alex-semenyuk:match_like_matches_macro_fix, r=Jarcho
bors [Fri, 15 Jul 2022 13:57:46 +0000 (13:57 +0000)]
Auto merge of #9178 - alex-semenyuk:match_like_matches_macro_fix, r=Jarcho

match_like_matches_macro does not trigger when one arm contains conta…

Close #9163
changelog: none

2 years agoAuto merge of #9174 - flip1995:rustup, r=Jarcho
bors [Fri, 15 Jul 2022 13:38:01 +0000 (13:38 +0000)]
Auto merge of #9174 - flip1995:rustup, r=Jarcho

Rustup

r? `@ghost`

changelog: none

2 years agoAuto merge of #9103 - i509VCB:std-instead-of-core, r=Manishearth
bors [Fri, 15 Jul 2022 11:46:24 +0000 (11:46 +0000)]
Auto merge of #9103 - i509VCB:std-instead-of-core, r=Manishearth

Add `std_instead_of_core`, `std_instead_of_alloc`, `alloc_instead_of_core`

Closes #7724

Introduces 3 new lints:
- `std_instead_of_core` - lints items resolved through `std` which are available in `core`
- `std_instead_of_alloc` - lints items resolved through `std` which are available in `alloc`
- `alloc_instead_of_core` - lints items resolved through `alloc` which are available in `core`

Though the original issue only mentions `std_instead_of_alloc`, the other two lints could be useful as well.

questions:
- what do I call the file the lints live in? I was thinking `std_reexports`?

changelog: new lint's: [`std_instead_of_core`], [`std_instead_of_alloc`], [`alloc_instead_of_core`]

2 years agoBump nightly version -> 2022-07-15
Philipp Krones [Fri, 15 Jul 2022 07:49:38 +0000 (09:49 +0200)]
Bump nightly version -> 2022-07-15

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Fri, 15 Jul 2022 07:49:15 +0000 (09:49 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agomatch_like_matches_macro does not trigger when one arm contains contains a block...
alex-semenyuk [Fri, 15 Jul 2022 06:15:31 +0000 (09:15 +0300)]
match_like_matches_macro does not trigger when one arm contains contains a block with only a bool literal

2 years agostd_instead_of_core, std_instead_of_alloc, alloc_instead_of_core
i509VCB [Sat, 2 Jul 2022 04:59:03 +0000 (23:59 -0500)]
std_instead_of_core, std_instead_of_alloc, alloc_instead_of_core

2 years agoAuto merge of #95956 - yaahc:stable-in-unstable, r=cjgillot
bors [Thu, 14 Jul 2022 13:42:09 +0000 (13:42 +0000)]
Auto merge of #95956 - yaahc:stable-in-unstable, r=cjgillot

Support unstable moves via stable in unstable items

part of https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/moving.20items.20to.20core.20unstably and a blocker of https://github.com/rust-lang/rust/pull/90328.

The libs-api team needs the ability to move an already stable item to a new location unstably, in this case for Error in core. Otherwise these changes are insta-stable making them much harder to merge.

This PR attempts to solve the problem by checking the stability of path segments as well as the last item in the path itself, which is currently the only thing checked.

2 years agoAuto merge of #9170 - Rqnsom:box_collection, r=Jarcho
bors [Thu, 14 Jul 2022 13:02:06 +0000 (13:02 +0000)]
Auto merge of #9170 - Rqnsom:box_collection, r=Jarcho

[`box_collection`]: raise warn for all std collections

So far, only [`Vec`, `String`, `HashMap`] were considered.

Extend collection checklist for this lint with:
- `HashSet`
- `VecDeque`
- `LinkedList`
- `BTreeMap`
- `BTreeSet`
- `BinaryHeap`

changelog: [`box_collection`]: raise warn for all std collections

2 years agoAuto merge of #9161 - Victor-N-Suadicani:move_format_push_string_to_pedantic, r=flip1995
bors [Thu, 14 Jul 2022 12:11:34 +0000 (12:11 +0000)]
Auto merge of #9161 - Victor-N-Suadicani:move_format_push_string_to_pedantic, r=flip1995

Move format_push_string to restriction

Fixes #9077 (kinda) by moving the lint to the restriction group. As I noted in that issue, I think the suggested change is too much and as the OP of the issue points out, the ramifications of the change are not necessarily easily understood. As such I don't think the lint should be enabled by default.

changelog: [`format_push_string`]: moved to restriction (see #9077).

2 years agoAdd Known problems section
Victor Nordam Suadicani [Thu, 14 Jul 2022 11:26:56 +0000 (13:26 +0200)]
Add Known problems section

2 years agoAuto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC
bors [Thu, 14 Jul 2022 11:00:30 +0000 (11:00 +0000)]
Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97720 (Always create elided lifetime parameters for functions)
 - #98315 (Stabilize `core::ffi:c_*` and rexport in `std::ffi`)
 - #98705 (Implement `for<>` lifetime binder for closures)
 - #99126 (remove allow(rustc::potential_query_instability) in rustc_span)
 - #99139 (Give a better error when `x dist` fails for an optional tool)

Failed merges:

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

2 years agoRollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot
Dylan DPC [Thu, 14 Jul 2022 08:44:21 +0000 (14:14 +0530)]
Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot

Implement `for<>` lifetime binder for closures

This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following:

```rust
let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) };
//       ^^^^^^^^^^^--- new!
```

cc ``@Aaron1011`` ``@cjgillot``

2 years agoRollup merge of #97720 - cjgillot:all-fresh, r=petrochenkov
Dylan DPC [Thu, 14 Jul 2022 08:44:19 +0000 (14:14 +0530)]
Rollup merge of #97720 - cjgillot:all-fresh, r=petrochenkov

Always create elided lifetime parameters for functions

Anonymous and elided lifetimes in functions are sometimes (async fns) --and sometimes not (regular fns)-- desugared to implicit generic parameters.

This difference of treatment makes it some downstream analyses more complicated to handle.  This step is a pre-requisite to perform lifetime elision resolution on AST.

There is currently an inconsistency in the treatment of argument-position impl-trait for functions and async fns:
```rust
trait Foo<'a> {}
fn foo(t: impl Foo<'_>) {} //~ ERROR missing lifetime specifier
async fn async_foo(t: impl Foo<'_>) {} //~ OK
fn bar(t: impl Iterator<Item = &'_ u8>) {} //~ ERROR missing lifetime specifier
async fn async_bar(t: impl Iterator<Item = &'_ u8>) {} //~ OK
```

The current implementation reports "missing lifetime specifier" on `foo`, but **accepts it** in `async_foo`.
This PR **proposes to accept** the anonymous lifetime in both cases as an extra generic lifetime parameter.
This change would be insta-stable, so let's ping t-lang.
Anonymous lifetimes in GAT bindings keep being forbidden:
```rust
fn foo(t: impl Foo<Assoc<'_> = Bar<'_>>) {}
                         ^^        ^^
                       forbidden   ok
```
I started a discussion here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Anonymous.20lifetimes.20in.20universal.20impl-trait/near/284968606

r? ``@petrochenkov``

2 years agoAuto merge of #9173 - giraffate:fix_the_minimal_version_for_clap, r=xFrednet
bors [Thu, 14 Jul 2022 08:27:58 +0000 (08:27 +0000)]
Auto merge of #9173 - giraffate:fix_the_minimal_version_for_clap, r=xFrednet

Fix the minimal version for `clap`

changelog: none

`clap >= 3.2.0` for lintcheck  has been needed from https://github.com/rust-lang/rust-clippy/pull/8997.

2 years agoAuto merge of #98975 - jyn514:unstable_opts, r=wesleywiser
bors [Thu, 14 Jul 2022 08:14:31 +0000 (08:14 +0000)]
Auto merge of #98975 - jyn514:unstable_opts, r=wesleywiser

Rename `debugging_opts` to `unstable_opts`

This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.

cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Codegen.20options.20.2F.20debugging.20options

r? `@Amanieu` cc `@nikic` `@joshtriplett`

2 years agoFix the minimal version for `clap`
Takayuki Nakata [Thu, 14 Jul 2022 00:46:46 +0000 (09:46 +0900)]
Fix the minimal version for `clap`

2 years agoRename `debugging_opts` to `unstable_opts`
Joshua Nelson [Wed, 6 Jul 2022 12:44:47 +0000 (07:44 -0500)]
Rename `debugging_opts` to `unstable_opts`

This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.

2 years agoadd array tests, cleanup, tidy, and bless
Ralf Jung [Thu, 30 Jun 2022 14:17:49 +0000 (10:17 -0400)]
add array tests, cleanup, tidy, and bless

2 years agoUpdate highlight.js
Serial [Tue, 17 May 2022 16:12:31 +0000 (12:12 -0400)]
Update highlight.js

2 years agoAuto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPC
bors [Wed, 13 Jul 2022 17:13:27 +0000 (17:13 +0000)]
Auto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98574 (Lower let-else in MIR)
 - #99011 (`UnsafeCell` blocks niches inside its nested type from being available outside)
 - #99030 (diagnostics: error messages when struct literals fail to parse)
 - #99155 (Keep unstable target features for asm feature checking)
 - #99199 (Refactor: remove an unnecessary `span_to_snippet`)

Failed merges:

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

2 years agoAuto merge of #9134 - Jarcho:while_let_iter_closure, r=dswij
bors [Wed, 13 Jul 2022 16:20:14 +0000 (16:20 +0000)]
Auto merge of #9134 - Jarcho:while_let_iter_closure, r=dswij

Improve `while_let_on_iterator` suggestion inside an `FnOnce` closure

changelog: Improve `while_let_on_iterator` suggestion inside an `FnOnce` closure

2 years agobox_collection: raise warn for all std collections
Korlo [Wed, 13 Jul 2022 15:02:09 +0000 (17:02 +0200)]
box_collection: raise warn for all std collections

So far, only [Vec, String, Hashmap] were considered.

Extend collection checklist for this lint with:
- HashSet
- VecDeque
- LinkedList
- BTreeMap
- BTreeSet
- BinaryHeap

2 years agoAuto merge of #9159 - alex-semenyuk:fix_typos, r=dswij
bors [Wed, 13 Jul 2022 14:48:32 +0000 (14:48 +0000)]
Auto merge of #9159 - alex-semenyuk:fix_typos, r=dswij

Fix typos

changelog: none

2 years agoFix typos
bors [Wed, 13 Jul 2022 14:48:32 +0000 (14:48 +0000)]
Fix typos

changelog: none

2 years agoAuto merge of #98145 - ouz-a:some_branch, r=oli-obk
bors [Wed, 13 Jul 2022 14:32:33 +0000 (14:32 +0000)]
Auto merge of #98145 - ouz-a:some_branch, r=oli-obk

Pull Derefer before ElaborateDrops

_Follow up work to #97025 #96549 #96116 #95887 #95649_

This moves `Derefer` before `ElaborateDrops` and creates a new `Rvalue` called `VirtualRef` that allows us to bypass many constraints for `DerefTemp`.

r? `@oli-obk`

2 years agoAuto merge of #9169 - Alexendoo:message-convention-regex, r=flip1995
bors [Wed, 13 Jul 2022 14:27:44 +0000 (14:27 +0000)]
Auto merge of #9169 - Alexendoo:message-convention-regex, r=flip1995

Use `LazyLock` for `lint_message_convention` regexes

They were being recompiled for `Message::new` call, for me this shaves 7s off the time it takes to run the test. Also removes a redundant exception from the list and joins the various `message...` exceptions into one

changelog: none

2 years agoUse LazyLock for lint_message_convention regexes
Alex Macleod [Wed, 13 Jul 2022 14:10:39 +0000 (14:10 +0000)]
Use LazyLock for lint_message_convention regexes

2 years agoRollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb
Dylan DPC [Wed, 13 Jul 2022 14:02:34 +0000 (19:32 +0530)]
Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb

`UnsafeCell` blocks niches inside its nested type from being available outside

fixes #87341

This implements the plan by `@eddyb` in https://github.com/rust-lang/rust/issues/87341#issuecomment-886083646

Somewhat related PR (not strictly necessary, but that cleanup made this PR simpler): #94527

2 years agoRollup merge of #98574 - dingxiangfei2009:let-else-thir, r=oli-obk
Dylan DPC [Wed, 13 Jul 2022 14:02:33 +0000 (19:32 +0530)]
Rollup merge of #98574 - dingxiangfei2009:let-else-thir, r=oli-obk

Lower let-else in MIR

This MR will switch to lower let-else statements in MIR building instead.

To lower let-else in MIR, we build a mini-switch two branches. One branch leads to the matching case, and the other leads to the `else` block. This arrangement will allow temporary lifetime analysis running as-is so that the temporaries are properly extended according to the same rule applied to regular `let` statements.

cc https://github.com/rust-lang/rust/issues/87335

Fix #98672

2 years agoAuto merge of #9156 - Rqnsom:manual_flatten, r=Alexendoo
bors [Wed, 13 Jul 2022 12:52:08 +0000 (12:52 +0000)]
Auto merge of #9156 - Rqnsom:manual_flatten, r=Alexendoo

fix [`manual_flatten`] help texts order

fixes  #8948

Whenever suggestion for this lint does not fit in one line,
legacy solution has some unexpected/unhandled behavior:
lint will then generate two help messages which seem to be shown in the wrong order.
The second help message in that case will contain the suggestion.

The first help message always refers to a suggestion message,
and **it should adapt** depending on the location of the suggestion:
- inline suggestion within the error/warning message
- suggestion separated into a second help text

This is my first contribution here, so I hope I didn't miss anything for creating this PR.

changelog: fix [`manual_flatten`] help texts order

2 years agoClippy fallout.
Camille GILLOT [Sat, 4 Jun 2022 12:17:00 +0000 (14:17 +0200)]
Clippy fallout.

2 years agoMove to restriction
Victor Nordam Suadicani [Wed, 13 Jul 2022 10:59:55 +0000 (12:59 +0200)]
Move to restriction

2 years agoRollup merge of #98848 - flip1995:clippy-book, r=jyn514
Guillaume Gomez [Wed, 13 Jul 2022 08:38:42 +0000 (10:38 +0200)]
Rollup merge of #98848 - flip1995:clippy-book, r=jyn514

Build the Clippy book as part of x.py doc

r? ``@ehuss`` since you said you would be interested in helping moving this forward.

cc ``@jyn514`` as part of the bootstrap team.

2 years agofix for manual_flatten help texts order
Korlo [Mon, 11 Jul 2022 14:53:04 +0000 (16:53 +0200)]
fix for manual_flatten help texts order

Whenever suggestion for this lint does not fit in one line,
lint will generate two help messages. The second help message
will always contain the suggestion.

The first help message refers to suggestion message,
and it should adapt depending on the location of the suggestion:
- inline suggestion within the error/warning message
- suggestion separated into second help text

2 years agoMoves format_push_string to pedantic.
Victor-N-Suadicani [Tue, 12 Jul 2022 21:11:19 +0000 (23:11 +0200)]
Moves format_push_string to pedantic.

2 years agoFix clippy build
Maybe Waffle [Thu, 30 Jun 2022 10:18:51 +0000 (14:18 +0400)]
Fix clippy build

2 years agoAuto merge of #9157 - Rqnsom:pull_request_template, r=flip1995
bors [Tue, 12 Jul 2022 16:07:38 +0000 (16:07 +0000)]
Auto merge of #9157 - Rqnsom:pull_request_template, r=flip1995

update pull request template

Improved suggestion for formatting lint names in the PR template to use this format:
[`lint_name`]

changelog: none

2 years agoAuto merge of #8703 - aldhsu:add_repeated_where_clause_or_trait_bound, r=flip1995
bors [Tue, 12 Jul 2022 15:48:55 +0000 (15:48 +0000)]
Auto merge of #8703 - aldhsu:add_repeated_where_clause_or_trait_bound, r=flip1995

Add `repeated_where_clause_or_trait_bound` lint

I thought I would try and scratch my own itch for #8674.

1. Is comparing the `Res` the correct way for ensuring we have the same trait?
2. Is there a way to get the spans for the bounds and clauses for suggestions?
I tried to use `GenericParam::bounds_span_for_suggestions` but it only gave me an empty span at the end of the spans.
I tried `WhereClause::span_for_predicates_or_empty_place` and it included the comma.
3. Is there a simpler way to get the trait names? I have used the spans of the traits because I didn't see a way to get it off the `Res` or `Def`.

changelog: Add ``[`repeated_where_clause_or_trait_bound`]`` lint.

2 years agoupdate pull request template
Korlo [Tue, 12 Jul 2022 09:17:30 +0000 (11:17 +0200)]
update pull request template

Improved suggestion for formatting lint names in the template:

    changelog: [`lint_name`]: your change

2 years agoLint for repeated traits within trait bounds or where clauses.
Allen Hsu [Tue, 12 Apr 2022 14:21:08 +0000 (00:21 +1000)]
Lint for repeated traits within trait bounds or where clauses.

2 years agoadd new rval, pull deref early
ouz-a [Mon, 13 Jun 2022 13:37:41 +0000 (16:37 +0300)]
add new rval, pull deref early

2 years agoAuto merge of #9149 - kyoto7250:issue_9013, r=Jarcho
bors [Tue, 12 Jul 2022 06:43:42 +0000 (06:43 +0000)]
Auto merge of #9149 - kyoto7250:issue_9013, r=Jarcho

change applicability type to MaybeIncorrect in `explicit_counter_loop`

close #9013

This PR changes  applicability type to `MaybeIncorrect`,  because the suggestion is not `MachineApplicable`.

changelog: change applicability type to MaybeIncorrect in `explicit_counter_loop`

2 years agodeclare span variable before call
kyoto7250 [Tue, 12 Jul 2022 02:00:22 +0000 (11:00 +0900)]
declare span variable before call

2 years agoAuto merge of #9138 - Jarcho:branches_sharing_code_2, r=giraffate
bors [Tue, 12 Jul 2022 00:38:54 +0000 (00:38 +0000)]
Auto merge of #9138 - Jarcho:branches_sharing_code_2, r=giraffate

Fixes for `branches_sharing_code`

fixes #7198
fixes #7452
fixes #7555
fixes #7589

changelog: Don't suggest moving modifications to locals used in any of the condition expressions in `branches_sharing_code`
changelog: Don't suggest moving anything after a local with a significant drop in `branches_sharing_code`

2 years agomove else block into the `Local` struct
Ding Xiang Fei [Tue, 5 Jul 2022 21:31:18 +0000 (23:31 +0200)]
move else block into the `Local` struct