Commit graph

20438 commits

Author SHA1 Message Date
Lzu Tao
0bc9f003a3 Check for 'static lifetime in return type 2024-07-26 00:27:40 +07:00
Lzu Tao
e53182a2b4 Factor out check_closure function
Also get the receiver T in `T.method(|| f())`.
2024-07-26 00:27:38 +07:00
Lzu Tao
32dc02a6ec Add regression test for issue 13073 2024-07-26 00:23:11 +07:00
bors
37f4fbb929 Auto merge of #13157 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-07-25 16:25:19 +00:00
Philipp Krones
71b0f0fcac
Bump Clippy version -> 0.1.82 2024-07-25 18:23:37 +02:00
Philipp Krones
09419e44e9
Bump nightly version -> 2024-07-25 2024-07-25 18:23:33 +02:00
Philipp Krones
9f53fc32cf
Merge remote-tracking branch 'upstream/master' into rustup 2024-07-25 18:23:27 +02:00
y21
de1e163779 get rid of unnecessary res field in for_each_expr visitors 2024-07-25 15:02:31 +02:00
bors
df0cb6c51e Auto merge of #13125 - xFrednet:changelog-1-80, r=dswij
Changelog for Clippy 1.80 🌞

Roses are red,
Violets are blue,
Summer is fun,
So much sun

---

### The cat of this release is *Maunzer* submitted by `@llogiq:`

<img height=500 src="https://github.com/rust-lang/rust-clippy/assets/4200835/a1da6948-446d-4ccf-95a7-c816a8afdc3f" alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none

I wish everyone reading this a beautiful and happy day =^.^=
2024-07-25 12:48:54 +00:00
bors
be8234098b Auto merge of #13139 - xFrednet:lintcheck-limit-summery-output, r=Alexendoo
Lintcheck: Rework and limit diff output for GH's CI

### Background

While working on https://github.com/rust-lang/rust-clippy/pull/13136 I found an amazing limitation of GH's CI. The summary can at most have be 1MB of text. Here is the warning message:

> $GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of 1024k, got 46731k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary

[The PR](https://github.com/rust-lang/rust-clippy/pull/13136) produced a *casual* 61808 changes. Guess that's why those lints are not *warn-by-default* :P.

### Changes:

This PR limits the lintcheck diff output in two ways.

1. The diff is limited to 200 messages per lint per section. Hidden messages are indicated by a message at the end of the section.
2. The output is first written to a file and only the first 1MB is written to ` >> $GITHUB_STEP_SUMMARY`. The entire file is also written to the normal CI log. This helps for cases where several lints change and the total size exceeds the 1MB limit.

An example of these changes can be seen here: https://github.com/xFrednet/rust-clippy/actions/runs/10028799118?pr=4

---

changelog: none

r? `@Alexendoo`

Sorry for bombarding you with so many PR's lately 😅 Feel free to pass some of you reviews to me.
2024-07-25 12:11:35 +00:00
bors
5e6540f049 Auto merge of #13146 - Alexendoo:cast-lossless-128, r=y21
Lint casts to `u128` in `cast_lossless`

Reverts #12496 per https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Should.20.60as.20u128.60.20trigger.20cast_lossless

Also changes the lint messages and refactors the suggestion production - Fixes #12695

changelog: [`cast_lossless`]: lint casts to `u128`
2024-07-24 21:00:05 +00:00
xFrednet
bdf3e585a3
Lintcheck: Review comments <3 2024-07-24 22:45:41 +02:00
Maja Kądziołka
e63061d75b
Apply review suggestion
Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>
2024-07-24 22:29:35 +02:00
Alex Macleod
6d28e1a954 Lint casts to u128 in cast_lossless 2024-07-24 14:32:41 +00:00
bors
16953cef82 Auto merge of #12830 - blyxyas:more-controlflow, r=y21,xFredNet
Use ControlFlow in more places

Now, instead of manually using variables in visitors to signify that a visit is "done" and that the visitor should stop traversing. We use the trait type "Result" to signify this (in relevant places).

I'll schedule a perf run, I don't think it will be much of a difference, but every bit of performance is welcomed :)

changelog: Improve performance, less memory use in visitors

Fixes #12829
r? `@y21`
2024-07-24 09:48:19 +00:00
bors
6d674685ae Auto merge of #127524 - oli-obk:feed_item_attrs2, r=petrochenkov
Make ast `MutVisitor` have the same method name and style as `Visitor`

It doesn't map 100% because some `MutVisitor` methods can filter or even expand to multiple items, but consistency seems nicer.

tracking issue: https://github.com/rust-lang/rust/issues/127615
2024-07-24 09:36:57 +00:00
bors
959477ea36 Auto merge of #13153 - Alexendoo:bind-instead-of-map-struct, r=Manishearth
Make `BindInsteadOfMap` a struct

Makes it codegen once instead of three times

changelog: none
2024-07-24 00:44:30 +00:00
blyxyas
b21a91ae3a Replace local variables signifying "done" or "loop break", use ControlFlow #12830 2024-07-24 01:40:58 +02:00
bors
615284aa5a Auto merge of #13151 - Alexendoo:nextest, r=Jarcho
Fix running compile-test under cargo nextest

`ui_test` itself has `cargo nextest` support which we now use - https://github.com/oli-obk/ui_test/pull/161

It prints `ui_test` as its test name whereas we printed `compile_test`, this ended up being treated as a test name filter causing all the tests to be filtered out

changelog: none
2024-07-23 22:30:02 +00:00
bors
760a278a1f Auto merge of #13154 - blyxyas:focus-on-contribs, r=blyxyas
Temporarily remove myself from reviewer rotation

I'm going to focus on the project goal and my own contributions, this + medical stuff leaves me not enough time to review.

I'll still review any performance related PR, and you can still request from me a benchmark for a PR, and will finish the PRs that I'm still assign to.

changelog: none
2024-07-23 22:21:39 +00:00
blyxyas
5ea7044d72 Temporarily remove myself from reviewer rotation 2024-07-23 23:52:26 +02:00
bors
e91d82eabb Auto merge of #13143 - Alexendoo:transmute-ptr-to-ptr-suggestions, r=y21
Suggest `.cast`/`.cast_const`/`.cast_mut` in `transmute_ptr_as_ptr`

Essentially pre-applies `ptr_as_ptr` - https://github.com/rust-lang/rust-clippy/issues/6372#issuecomment-1830438907

changelog: none
2024-07-23 21:48:07 +00:00
Alex Macleod
493498b65f Make BindInsteadOfMap a struct
Makes it codegen once instead of three times
2024-07-23 20:57:35 +00:00
Alex Macleod
af6d49d97c Fix running compile-test under cargo nextest 2024-07-23 16:15:54 +00:00
bors
bd1224d8aa Auto merge of #13148 - xFrednet:lintcheck-link-correction-again, r=Alexendoo
Lintcheck: Support underscores replacement in URL crate names

The generated URLs use `{krate}` for the crate name. This works well for the first part of the docs.rs domain, but the second part is actually the root module, which requires a replacement of all dashes with underscores. This PR adds `{krate_}` for the root module name.

Diff:

```diff
 Removed `clippy::needless_borrows_for_generic_args` in `rustls-pemfile` at
-https://docs.rs/rustls-pemfile/2.1.2/src/rustls-pemfile/pemfile.rs.html#194
+https://docs.rs/rustls-pemfile/2.1.2/src/rustls_pemfile/pemfile.rs.html#194
```

> Example before: https://github.com/xFrednet/rust-clippy/actions/runs/10054236377?pr=4
> Example after: https://github.com/xFrednet/rust-clippy/actions/runs/10054878594?pr=4

---

changelog: none

r? `@Alexendoo`
2024-07-23 11:51:53 +00:00
Alex Macleod
7010d3c67e Don't suggest .cast_mut/.cast_const for types with erased lifetimes 2024-07-23 11:12:26 +00:00
jusexton
0cdf6e172c Fix while_let_on_iterator dropping loop label when applying fix. 2024-07-23 02:55:58 -05:00
xFrednet
04693a4eca
Lintcheck: Support underscores replacement in URL crate names 2024-07-23 09:46:59 +02:00
bors
df1baedfde Auto merge of #13050 - Jarcho:misc_small, r=xFrednet
Misc refactorings

Various small re-orderings to check the HIR tree or AST before doing other checks. Also includes a small bug fix for `arc_with_small_send_sync` not actually checking for `Arc::new`.

changelog: none
2024-07-22 20:25:05 +00:00
Michael Goulet
e2a7000b6b Get rid of infer_ctxt_ext 2024-07-22 16:15:52 -04:00
bors
f9c240720a Auto merge of #13072 - Jarcho:misc_small5, r=xFrednet
Misc refactorings part 5

`toplevel_ref_arg` gets a small fix so it can be allowed on function arguments. Otherwise just some rearrangements.

changelog: none
2024-07-22 19:58:25 +00:00
bors
637d39fab8 Auto merge of #13065 - Jarcho:misc_small2, r=xFrednet
Misc refactorings part 2

A couple of theses are a bit more involved. No behaviour changes included in this set.

changelog: none
2024-07-22 19:40:50 +00:00
xFrednet
d17f113474
Make restriction lint's use span_lint_and_then (m -> m) 2024-07-22 19:47:34 +02:00
xFrednet
bc8fc6b1d8
Make restriction lint's use span_lint_and_then (i -> l) 2024-07-22 19:47:29 +02:00
Alex Macleod
afe811ad30 Suggest .cast/.cast_const/.cast_mut in transmute_ptr_as_ptr 2024-07-22 17:31:45 +00:00
xFrednet
23b231a5d6
Lintcheck: Fix Errors, because of course 2024-07-22 18:19:37 +02:00
xFrednet
10bf729e3f
Lintcheck: Include truncated diff in CI artifacts 2024-07-22 18:10:03 +02:00
xFrednet
1f879fc0cf
Lintcheck: Minor cleanup and function moves 2024-07-22 18:02:39 +02:00
xFrednet
4fea5199e4
Lintcheck: Order summary by lint and truncate messages 2024-07-22 17:59:26 +02:00
xFrednet
4798383c33
Lintcheck: Limit summary size to 1024k and copy to logs 2024-07-22 17:59:09 +02:00
Oli Scherer
221ac86e09 Always pass the visitor as the first argument to walk* functions 2024-07-22 14:01:24 +00:00
Oli Scherer
3149037b57 Sync mut_visit function names with immut visit ones (s/noop_visit/walk/) 2024-07-22 14:01:24 +00:00
Michael Goulet
efde1c065b Fix tools 2024-07-21 22:34:37 -04:00
Michael Goulet
897c4d3adb Move all error reporting into rustc_trait_selection 2024-07-21 22:34:35 -04:00
bors
1807580a49 Auto merge of #12772 - phi-gamma:redundant-struct-recreation, r=y21
add lint for recreation of an entire struct

This lint makes Clippy warn about situations where an owned struct is
essentially recreated by moving all its fields into a new instance of
the struct. The lint is not machine-applicable because the source
struct may have been partially moved.

This lint originated in something I spotted during peer review. While
working on their branch a colleague ended up with a commit where a
function returned a struct that 1:1 replicated one of its owned inputs
from its members. Initially I suspected they hadn’t run their code
through Clippy but AFAICS there is no lint for this situation yet.

changelog: new lint: [`redundant_owned_struct_recreation`]

### New lint checklist

- \[+] Followed [lint naming conventions][lint_naming]
- \[+] Added passing UI tests (including committed `.stderr` file)
- \[+] `cargo test` passes locally
- \[+] Executed `cargo dev update_lints`
- \[+] Added lint documentation
- \[+] Run `cargo dev fmt`
2024-07-21 23:02:38 +00:00
bors
5f3d385421 Auto merge of #120812 - compiler-errors:impl-sorting, r=lcnr
Remove unnecessary impl sorting in queries and metadata

Removes unnecessary impl sorting because queries already return their keys in HIR definition order: https://github.com/rust-lang/rust/issues/120371#issuecomment-1926422838

r? `@cjgillot` or `@lcnr` -- unless I totally misunderstood what was being asked for here? 😆

fixes #120371
2024-07-21 22:43:47 +00:00
bors
7f0ed11213 Auto merge of #13133 - xFrednet:lintcheck-linkify-summary, r=Alexendoo
Lintcheck: Cleanup of Lintcheck's CI summery

This PR makes three changes to lintcheck's job summary:
* Adds links to the *Added*, *Removed*, *Changed* sections
* Added the crate name to the warning info
* Removes empty lines from the rendered output

This is what the new output roughly looks like:

![image](https://github.com/user-attachments/assets/3faae0a6-e5ee-4e70-9d4d-d19b18dc6a3a)
![image](https://github.com/user-attachments/assets/028c3a92-98dc-4e00-b7bb-fecf9450f5b1)

[🖼️ Old Output 🖼️](https://github.com/xFrednet/rust-clippy/actions/runs/10019681444)

[🖼️ New Output 🖼️](https://github.com/xFrednet/rust-clippy/actions/runs/10019598141)

The links for the sections are a bit weird as you have to click on them twice. I believe this is a bug from GH's side. But it works reasonably well :D

---

changelog: none

r? `@Alexendoo`
2024-07-21 12:37:00 +00:00
bors
8fe5c757d5 Auto merge of #11700 - lengyijun:pathbuf_join, r=xFrednet
[`pathbuf_init_then_push`]:  Checks for calls to `push` immediately a…

changelog: [`pathbuf_init_then_push`]: new lint: Checks for calls to `push` immediately after creating a new `PathBuf`

Just a mirror of VEC_INIT_THEN_PUSH
2024-07-21 06:39:01 +00:00
lengyijun
cb77f12600 [pathbuf_init_then_push]: Checks for calls to push immediately after creating a new PathBuf
Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>
2024-07-21 14:22:48 +08:00
xFrednet
69c3289f2b
Lintcheck: Include the crate name in the CI job summary 2024-07-20 13:25:44 +02:00