Commit Graph

14615 Commits

Author SHA1 Message Date
Jason Newcomb
ab6463e9d9 Fix ICE in miri_to_const 2022-07-24 18:23:33 -04:00
bors
20e4204730 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](c32dcbba18/compiler/rustc_span/src/span_encoding.rs (L86-L88)). So with a single character variable like `format!("{x}")` it still worked
2022-07-24 17:21:15 +00:00
Alex Macleod
d60d5e8bde Fix useless_format spans for format!("{foo}") 2022-07-24 16:47:17 +00:00
bors
4a5b7e266a Auto merge of #9235 - alex-semenyuk:fixing_guide_link, r=llogiq
Fix src link

changelog: none
2022-07-24 11:49:22 +00:00
alexey semenyuk
663cddc210
Fix src link 2022-07-24 11:22:50 +03:00
bors
580f642cfa 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
2022-07-23 13:05:21 +00:00
Ralf Jung
a7389556f8 fix outdated lint names in docs 2022-07-23 08:36:26 -04:00
bors
75dcbd5b92 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
2022-07-23 11:59:19 +00:00
Max Baumann
6620aa0583
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>
2022-07-22 16:39:45 +02:00
bors
05a51e5730 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.
2022-07-21 17:00:40 +00:00
bors
fa3c293db4 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
2022-07-21 15:45:50 +00:00
bors
bc903cd3c2 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
2022-07-21 07:58:27 +00:00
bors
d017e2dacd Auto merge of #9217 - Serial-ATA:extra-newlines, r=giraffate
Remove extra newlines in [`significant_drop_in_scrutinee`] docs

changelog: none
2022-07-21 06:04:43 +00:00
Serial
8dfea74367 Remove extra newlines in [significant_drop_in_scrutinee] docs 2022-07-20 21:35:11 -04:00
alex-semenyuk
27d49b08d5 Enable test for entrypoint_recursion for windows 2022-07-20 21:41:12 +03:00
Jason Newcomb
a2f9b93116 Don't lint assign_op_pattern when the suggestion would cause borrowck errors 2022-07-20 10:23:07 -04:00
bors
7c8e1bff90 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!`
2022-07-20 01:38:00 +00:00
bors
e98b3ca87b 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
2022-07-19 21:16:34 +00:00
Evan Typanski
40340745a8 Use parens around [needless_borrow] field calls 2022-07-19 15:17:24 -04:00
Jason Newcomb
95c759157c Check for todo! on every expression in SpanlessEq 2022-07-19 09:57:18 -04:00
bors
e57c6d6f21 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
2022-07-18 16:10:06 +00:00
Paul
c94ca1c625
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.
2022-07-18 16:24:30 +02:00
bors
cce617165d 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`
2022-07-18 12:45:11 +00:00
bors
bf70865cf4 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.
2022-07-18 12:29:22 +00:00
bors
f4c9183531 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
2022-07-18 10:13:39 +00:00
Xiretza
7a5965b459 unused_self: respect avoid-breaking-exported-api 2022-07-18 10:57:08 +02:00
bors
79a0d234fe Auto merge of #9176 - JoelMon:patch-1, r=flip1995
Rephrased text to remove passive voice for a more active one.

changelog: none
2022-07-18 07:46:30 +00:00
Joel Montes de Oca
659a9ac8bf
Rephrased text to remove passive voice for a more active one.
Co-authored-by: Alex <69764315+Serial-ATA@users.noreply.github.com>
2022-07-18 09:45:01 +02:00
Samuel E. Moelius III
5b3300dc29 Add ui_cargo_toml_metadata test 2022-07-17 22:17:58 -04:00
Ariel Uy
9ff7c91100 Add new lint obfuscated_if_else
New lint suggests using `if .. else ..` instead of
`.then_some(..).unwrap_or(..)`.
2022-07-17 18:44:49 -07:00
bors
fdb84cbfd2 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
2022-07-17 23:08:04 +00:00
alexey semenyuk
142898e544
Fix example for clippy::invalid_regex 2022-07-18 00:35:34 +03:00
Ariel Uy
8cf39a8c19 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.
2022-07-17 11:23:09 -07:00
bors
3a4e4575ed 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`
2022-07-17 13:33:40 +00:00
alexey semenyuk
e7804355de 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
2022-07-17 16:13:58 +03:00
bors
4562dd0a8e 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! 😄

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`
2022-07-16 20:02:44 +00:00
bors
b1e2578f83 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
2022-07-15 16:04:30 +00:00
Guilherme-Vasconcelos
b707a23814 Rename rustcSource in contributing docs 2022-07-15 12:36:57 -03:00
bors
aa0706bf20 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
2022-07-15 13:57:46 +00:00
bors
fe6814508f Auto merge of #9174 - flip1995:rustup, r=Jarcho
Rustup

r? `@ghost`

changelog: none
2022-07-15 13:38:01 +00:00
bors
c9f0d1aca7 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`]
2022-07-15 11:46:24 +00:00
Philipp Krones
9178ba1f55
Bump nightly version -> 2022-07-15 2022-07-15 09:49:38 +02:00
Philipp Krones
f074034590
Merge remote-tracking branch 'upstream/master' into rustup 2022-07-15 09:49:15 +02:00
alex-semenyuk
2894df3409 match_like_matches_macro does not trigger when one arm contains contains a block with only a bool literal 2022-07-15 09:15:31 +03:00
i509VCB
2f825db578
std_instead_of_core, std_instead_of_alloc, alloc_instead_of_core 2022-07-14 16:05:52 -05:00
bors
6dc9746147 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.
2022-07-14 13:42:09 +00:00
bors
0f5a38f2d6 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
2022-07-14 13:02:06 +00:00
bors
10e85efc53 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).
2022-07-14 12:11:34 +00:00
Victor Nordam Suadicani
43ac256cd1 Add Known problems section 2022-07-14 13:26:56 +02:00
bors
c9a78ee274 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
2022-07-14 11:00:30 +00:00