Commit Graph

20030 Commits

Author SHA1 Message Date
bors
bd75e44f6e Auto merge of #12655 - SpencerAWill:Add-applicability-filter, r=xFrednet
Add applicability filter to lint list page

changelog: Add applicability filter to lint list website.
Fixes #7958

Desktop view:
![image](https://github.com/rust-lang/rust-clippy/assets/43732866/ef16dff1-c1c5-48a7-aa5c-ddd504280c90)

Mobile view:
![image](https://github.com/rust-lang/rust-clippy/assets/43732866/9e6f54d9-b079-443f-a6b0-ca8ee4ed1eed)
2024-06-18 09:25:16 +00:00
bors
7e1ed1ad71 Auto merge of #12953 - Centri3:back, r=Centri3
Add myself back to reviewer rotation

Hey 👋

Even though I might have less time than usual, $DAY_JOB soon and working on Cosmographic Software for fun, I think I want to get back in the swing of things here

changelog: none
2024-06-18 07:36:20 +00:00
Centri3
e28b998fe6 Add myself back to reviewer rotation 2024-06-18 02:28:20 -05:00
bors
9e54ff2952 Auto merge of #12906 - lochetti:manual_unwrap_or_if_let, r=y21
Lint `manual_unwrap_or` for it let cases

This PR modifies `manual_unwrap_or` to lint for `if let` cases as well. This effort is part of the fixes desired by https://github.com/rust-lang/rust-clippy/issues/12618

changelog:[`manual_unwrap_or`]: Lint for `if let` cases.
2024-06-17 21:21:56 +00:00
bors
51c5eee9e6 Auto merge of #12945 - Jarcho:octal_escape, r=Alexendoo
Rework `octal_escapes`

Main changes are not doing UTF-8 decoding, noting each occurrence as an individual lint emission, and narrowing the span to point to the escape itself.

changelog: none
2024-06-17 20:12:43 +00:00
bors
0625183e28 Auto merge of #12903 - Jarcho:issue_12284, r=y21
Fix ICE in `upper_case_acronyms`

fixes #12284

The logic has been rewritten to avoid allocations. The old version allocated multiple vecs and strings for each identifier. The new logic allocates a single string only when the lint triggers.

This also no longer lints on strings which don't start with an uppercase letter (e.g. `something_FOO`).

changelog: none
2024-06-17 15:45:38 +00:00
bors
9550481056 Auto merge of #12947 - xFrednet:00000-summer-assignments, r=xFrednet
Pause assignments to @xFrednet for summer break 🏖️

I'm only removing myself from the assignment roulette as I want to allow `r? xFrednet` for `gh-pages` and other updates. So feel free to still `r?` me.

r? `@ghost`

changelog: none
2024-06-17 13:26:54 +00:00
xFrednet
198bbf87a0
Pause assignments to @xFrednet for summer break 🏖️
I'm only removing myself from the assignment roulette as I want to allow `r? xFrednet` for `gh-pages` and other updates. So feel free to still `r?` me.
2024-06-17 15:22:50 +02:00
bors
2ad53f4e38 Auto merge of #12943 - Jarcho:range_sym, r=llogiq
Use symbols when raising range expressions.

----

changelog: none
2024-06-17 12:15:18 +00:00
bors
6172178d22 Auto merge of #12938 - elijah-potter:patch-1, r=flip1995
Fix minor typo

changelog: none
2024-06-17 08:35:44 +00:00
Jason Newcomb
4b16e265a7 Rework octal_escapes. 2024-06-16 22:36:24 -04:00
Jason Newcomb
f09650b347 Use symbols when raising range expressions. 2024-06-16 20:24:43 -04:00
bors
16efa56503 Auto merge of #12287 - Jarcho:issue_12250, r=llogiq
Add lint `manual_inspect`

fixes #12250

A great example of a lint that sounds super simple, but has a pile of edge cases.

----

changelog: Add lint `manual_inspect`
2024-06-16 22:54:40 +00:00
Jason Newcomb
22710f33a8 Add lint manual_inspect 2024-06-16 18:33:43 -04:00
Jason Newcomb
a002f93e51 expr_use_ctxt changes:
* Delay the parsing of the use node
* Mark when the `SyntaxContext` changes rather than return `None`
* Return a default value if the HIR tree is broken rather than `None`
2024-06-16 18:00:21 -04:00
bors
9f5d60f160 Auto merge of #12893 - kyleoneill:field_scoped_visibility_modifiers, r=blyxyas
Add field_scoped_visibility_modifiers lint

changelog: [`field_scoped_visibility_modifiers`]: Add a lint which checks for struct fields using Restricted (not inherited, not public) visibility modifiers.
2024-06-16 20:14:20 +00:00
kyle oneill
3405ce3bca Add field_scoped_visibility_modifiers lint 2024-06-16 15:54:48 -04:00
bors
8065e0f61c Auto merge of #12939 - Alexendoo:lintcheck-popular-crates, r=xFrednet
Merge lintcheck popular-crates bin as a subcommand

Also rewrites it to use `ureq` to drop some heavy dependencies as `crates_io_api` brings in `reqwest`

r? `@xFrednet`

changelog: none
2024-06-16 19:19:48 +00:00
Alex Macleod
3a983c399a Merge lintcheck popular-crates bin as a subcommand 2024-06-16 18:28:00 +00:00
bors
a2c9782128 Auto merge of #10398 - Alexendoo:auto-lintcheck, r=xFrednet
Run a diff of lintcheck against the merge base for pull requests

changelog: none
<!-- changelog_checked -->

This is an MVP of sorts, it consists of #9764 + a GitHub action that feeds the output to the [job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary). It doesn't yet do anything fancy like `--recursive` or adding comments to the PR, so you'd have to click through to the action to see the results

Example output of a change (0be1ab82f8): https://github.com/Alexendoo/rust-clippy/actions/runs/4264858870#summary-11583333018

r? `@flip1995`
2024-06-16 10:03:12 +00:00
bors
82345c30ae Auto merge of #12937 - AurelienFT:add_msrv_manual_patter_char_comparison, r=Alexendoo
Add MSRV for manual_pattern_char_comparison

Fixes #12936

changelog: [`manual_pattern_char_comparison`]: Add MSRV 1.58
2024-06-15 23:33:49 +00:00
Elijah Potter
bcc7b0e700 Fix minor typo 2024-06-15 13:59:35 -06:00
AurelienFT
51c6630d4f Change MSRV check for manual_pattern_char_comparison only for pattern arrays 2024-06-15 21:52:42 +02:00
AurelienFT
63388cbab8 add MSRV for manual_pattern_char_comparison 2024-06-15 21:45:35 +02:00
bors
0dc265ff82 Auto merge of #12756 - y21:assigning_clones_lifetimes, r=Alexendoo
Avoid emitting `assigning_clones` when cloned data borrows from the place to clone into

Fixes #12444
Fixes #12460
Fixes #12749
Fixes #12757
Fixes #12929

I think the documentation for the function should describe what- and how this is fixing the issues well.
It avoids emitting a warning when the data being cloned borrows from the place to clone into, which is information that we can get from `PossibleBorrowerMap`. Unfortunately, it is a tiny bit tedious to match on the MIR like that and I'm not sure if this is possibly relying a bit too much on the exact MIR lowering for assignments.

Things left to do:
- [x] Handle place projections (or verify that they work as expected)
- [x] Handle non-`Drop` types

changelog: [`assigning_clones`]: avoid warning when the suggestion would lead to a borrow-check error
2024-06-15 18:25:42 +00:00
Alex Macleod
feb0671893 Add lintcheck diff github action 2024-06-15 13:58:10 +00:00
Alex Macleod
477b0c6a78 lintcheck: Add JSON output, diff subcommand 2024-06-15 13:58:10 +00:00
bors
73c1bfbc57 Auto merge of #12880 - bitfield:fix_doc_nits_b, r=Alexendoo
Fix doc nits

Clippy is wonderful, and reading its lints is a great way to learn about Rust. While doing this, I noticed a few little copyedits, such as adding trailing periods to sentences, or tweaking wording very slightly to improve its readability. I hope you will accept these suggestions as an act of love for the project, with my thanks for all the maintainers' hard work.

changelog: Docs [ mut_range_bound ]: fix doc nits
changelog: Docs [ needless_for_each ]: fix doc nits
changelog: Docs [ arc_with_non_send_sync ]: fix doc nits
changelog: Docs [ allow_attributes ]: fix doc nits
changelog: Docs [ allow_attributes_without_reason ]: fix doc nits
2024-06-15 13:43:53 +00:00
bors
3e5a02b13b Auto merge of #12921 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-06-13 10:25:51 +00:00
Philipp Krones
89658ef820
Bump nightly version -> 2024-06-13 2024-06-13 12:24:17 +02:00
Philipp Krones
614966b0c3
Bump Clippy version -> 0.1.81 2024-06-13 12:24:14 +02:00
Philipp Krones
cc63143bbf
Merge remote-tracking branch 'upstream/master' into rustup 2024-06-13 12:24:08 +02:00
bors
aaade2d12d Auto merge of #12855 - tesuji:fix-author-lint, r=Jarcho
Fix typos of author lint

changelog: none
2024-06-11 22:49:18 +00:00
bors
38d12a9bc0 Auto merge of #12681 - y21:issue12677, r=Jarcho
Let `qualify_min_const_fn` deal with drop terminators

Fixes #12677

The `method_accepts_droppable` check that was there seemed overly conservative.
> Returns true if any of the method parameters is a type that implements `Drop`.
> The method can't be made const then, because `drop` can't be const-evaluated.

Accepting parameters that implement `Drop` should still be fine as long as the parameter isn't actually dropped, as is the case in the linked issue where the droppable is moved into the return place. This more accurate analysis ("is there a `drop` terminator") is already done by `qualify_min_const_fn` [here](f5e250180c/clippy_utils/src/qualify_min_const_fn.rs (L298)), so I don't think this additional check is really necessary?

Fixing the other, second case in the linked issue was only slightly more involved, since `Vec::new()` is a function call that has the ability to panic, so there must be a `drop()` terminator for cleanup, however we should be able to freely ignore that. [Const checking ignores cleanup blocks](https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/transform/check_consts/check.rs#L382-L388), so we should, too?

r? `@Jarcho`

----

changelog: [`missing_const_for_fn`]: continue linting on fns with parameters implementing `Drop` if they're not actually dropped
2024-06-11 22:38:52 +00:00
bors
740b72ef79 Auto merge of #12849 - AurelienFT:manual-char-comparison-pattern, r=Alexendoo
Add lint to check manual pattern char comparison

This PR adds a new lint asked in https://github.com/rust-lang/rust-clippy/issues/12490

This lint catches manual char comparison in pattern of string functions and propose to use `char` or array of `char` instead.

As it's my first contribution i'm not feeling very safe about not matching too much or missing some cases.

Thanks in advance for taking time to review and propose feedback !

changelog: new lint [`manual_pattern_char_comparison`]
2024-06-11 22:15:43 +00:00
AurelienFT
c86b19f1ef Add lint to check manual pattern char comparison and merge its code with single_char_pattern lint 2024-06-11 21:56:14 +02:00
bors
9ddea51a73 Auto merge of #12912 - lochetti:fix_12824, r=dswij
Don't lint indexing_slicing lints on proc macros

This pr fixes https://github.com/rust-lang/rust-clippy/issues/12824

Even though the issue mentions the indexing case only, it was easy to apply the fix to the slicing case as well.

changelog: [`out_of_bounds_indexing`, `indexing_slicing`]: Don't lint on procedural macros.
2024-06-11 15:27:36 +00:00
bors
87c895ad83 Auto merge of #12915 - belyakov-am:lint/single_char_add_str, r=xFrednet
Handle single chars with `to_string()` for `single_char_add_str`

Add support for single chars / literals with `to_string()` call for `push_str()` and `insert_str()`.

changelog: [`single_char_add_str`]: handle single chars with `to_string()` call

Closes #12775
2024-06-11 11:08:45 +00:00
bors
dbdc43738b Auto merge of #12913 - alex-semenyuk:ui_fix, r=xFrednet
Filter from first typed symbol on gh-pages

Cosmetic fix
Don't see the reason that now filter on gh-pages is starting work after 3 symbols typing so remove this condition

Before:

https://github.com/rust-lang/rust-clippy/assets/5480441/fa3b780e-30dc-4fdb-bf2d-5a99337eca4e

After:

https://github.com/rust-lang/rust-clippy/assets/5480441/977e15af-8be5-462c-a703-f10c05e6109c

changelog: gh-pages
2024-06-11 10:58:05 +00:00
bors
acdf564692 Auto merge of #12904 - Jarcho:issue_10750, r=xFrednet
Normalize type aliases when checking significant drops.

fixes #10750

No test as I'm not sure exactly how the type alias caused a stack overflow here. Also removes an unnecessary `HashSet`.

changelog: none
2024-06-11 10:47:49 +00:00
Matthias Krüger
35f54fd439 Rollup merge of #126159 - RalfJung:scalarint-size-mismatch, r=oli-obk
ScalarInt: size mismatches are a bug, do not delay the panic

Cc [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Why.20are.20ScalarInt.20to.20iN.2FuN.20methods.20fallible.3F)

r? ``@oli-obk``
2024-06-10 21:12:25 +02:00
Ralf Jung
8c1f953772 ScalarInt: size mismatches are a bug, do not delay the panic 2024-06-10 13:43:16 +02:00
Renato Lochetti
f7515ae905
Don't lint indexing_slicing lints on proc macros 2024-06-10 09:08:56 +01:00
Artem Belyakov
f7723cada7 Fix dogfood test 2024-06-09 21:23:59 +03:00
Artem Belyakov
55344c84a5 Handle single chars with to_string() for single_char_add_str 2024-06-09 21:01:00 +03:00
alexey semenyuk
3f9c5872b9
Filter from first typed symbol 2024-06-09 17:37:05 +05:00
clubby789
5acc25e700 Update icu4x dependencies 2024-06-09 07:47:42 +01:00
Renato Lochetti
70ca9a1e7e
Lint manual_unwrap_or for it let cases 2024-06-08 14:39:03 +01:00
Lzu Tao
2855a876a7 fix typos of author lint 2024-06-08 12:31:49 +00:00
bors
48686adf48 Auto merge of #12805 - Alexendoo:blocks-in-conditions-closures, r=dswij
Don't lint blocks in closures for blocks_in_conditions

Seemed like an outlier for the lint which generally caught only the syntactically confusing cases, it lints blocks in closures but excludes closures passed to iterator methods, this changes it to ignore closures in general

changelog: none
2024-06-08 09:45:22 +00:00