Commit graph

20372 commits

Author SHA1 Message Date
Vadim Petrochenkov
8c718e5524 ast: Standardize visiting order for attributes and node IDs 2024-06-24 16:08:51 +03:00
Ricardo Fernández Serrata
cfccdbb164 Clarify that modulo_one only applies to ints 2024-06-24 03:57:55 -04:00
David Tolnay
35ec4eb354 Rename the 2 unambiguous precedence levels to PREC_UNAMBIGUOUS 2024-06-23 18:31:47 -07:00
bors
32374a196d Auto merge of #12930 - DaniPopes:missing-const-for-fn-suggestion, r=Jarcho
[`missing_const_for_fn`]: add machine-applicable suggestion

Add a machine-applicable suggestion to the `missing_const_for_fn` lint.

changelog: [`missing_const_for_fn`]: add machine-applicable suggestion
2024-06-23 20:04:27 +00:00
Alex Macleod
2194304b05 Cache lintcheck binary in ci 2024-06-23 17:05:46 +00:00
bors
9628130541 Auto merge of #12985 - llogiq:fix-integration-test, r=Alexendoo
use short message format in integration test

While checking #12983, bors came upon a cargo change that put "E0463" into the standard error (as part of a test case code snippet), which the integration test picked up to fail the build. Talk about unforeseen consequences.

So this PR just changes the integration test to use short message format in order to not include the code snippets in the output. Hopefully that will fix the problem.

r? `@Alexendoo`

---

changelog: none
2024-06-23 15:26:44 +00:00
Andre Bogus
51ccad6986
use short message format in integration test 2024-06-23 17:20:07 +02:00
John Arundel
625091d236 Fix doc nits 2024-06-23 13:11:54 +01:00
bors
26c556dd63 Auto merge of #12965 - KisaragiEffective:resolve-invalid-paths-on-bool-then, r=blyxyas
resolve `clippy::invalid_paths` on `bool::then`

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

changelog: none
2024-06-22 22:47:21 +00:00
Guillaume Gomez
58fc27f571 Rollup merge of #126723 - estebank:dot-dot-dot, r=Nadrieril
Fix `...` in multline code-skips in suggestions

When we have long code skips, we write `...` in the line number gutter.

For suggestions, we were "centering" the `...` with the line, but that was inconsistent with what we do in every other case *and* off-center.
2024-06-22 12:57:19 +02:00
bors
0ce07f61db Auto merge of #12961 - GuillaumeGomez:fix-manual_unwrap_or_default, r=Alexendoo
Fix incorrect suggestion for `manual_unwrap_or_default`

Fixes #12928.

If this not a "simple" pattern, better not emit the lint.

changelog: Fix incorrect suggestion for `manual_unwrap_or_default`
2024-06-21 17:05:43 +00:00
Guillaume Gomez
54b45f7f93 Fix incorrect suggestion for manual_unwrap_or_default 2024-06-21 18:18:28 +02:00
bors
fe2fe7feed Auto merge of #12972 - Jarcho:span_ex, r=Manishearth
Add new span related utils

The none-generic versions of the functions exist to help with both compile times and codegen.

changelog: None
2024-06-21 16:07:03 +00:00
Jason Newcomb
4baae5d8b3 Add new Span utils to avoid both allocating and
compressing/decompressing spans.
2024-06-21 03:23:06 -04:00
J-ZhengLi
dcb6a54b80 fix wrong msrv import in new_lint template 2024-06-21 12:03:40 +08:00
Michael Goulet
f6661f5b9b StaticForeignItem and StaticItem are the same 2024-06-20 19:51:09 -04:00
bors
3e84ca8ac9 Auto merge of #12368 - vohoanglong0107:unnecessary-min, r=Alexendoo
Unnecessary call to min/max method

Continuation of https://github.com/rust-lang/rust-clippy/pull/12061
Fix https://github.com/rust-lang/rust-clippy/issues/11901 and https://github.com/rust-lang/rust-clippy/issues/11924

This implementation only deal with literal int, like `i32::MAX`, `-6_i32`, `0`

changelog: added lint [`unnecessary_min_max`]
2024-06-20 14:12:57 +00:00
vohoanglong0107
2f9f204123 feat: unnecessary_min_max lint 2024-06-20 13:57:16 +00:00
Esteban Küber
3baafd2e8c Fix ... in multline code-skips in suggestions
When we have long code skips, we write `...` in the line number gutter.

For suggestions, we were "centering" the `...` with the line, but that was consistent with what we do in every other case.
2024-06-20 04:25:17 +00:00
Kisaragi Marine
9749d990ed
resolve clippy::invalid_paths on bool::then 2024-06-20 11:45:45 +09:00
y21
ed9ccf66e9 [unnecessary_to_owned]: catch to_owned from byte slice to string 2024-06-20 00:09:31 +02:00
bors
4aee08f999 Auto merge of #12963 - lochetti:fix_12874, r=Centri3
Don't lint `implicit_return` on proc macros

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

changelog: [`implicit_return`]: Don't lint on procedural macros.
2024-06-19 19:01:28 +00:00
Renato Lochetti
b147b6d03d
Don't lint implicit_return on proc macros 2024-06-19 19:16:09 +01:00
Trevor Gross
c693f31ee2 Update float tests to include f16 and f128 2024-06-19 13:30:21 -04:00
Trevor Gross
8cde354f0b Resolve Clippy f16 and f128 unimplemented!/FIXMEs
This removes the ICE codepaths for `f16` and `f128` in Clippy.
`rustc_apfloat` is used as a dependency for the parsing of these types,
since their `FromStr` implementation will not be available in the
standard library for a while.
2024-06-19 13:30:21 -04:00
bors
29cc5c691c Auto merge of #12942 - Jarcho:ex_proc_macro, r=Manishearth
Add more types to `is_from_proc_macro`

I've been running through going through all the lint implementations to clean them up. I'll be separating out the changes into small PRs to make reviewing easier.

changelog: none
2024-06-18 23:45:47 +00:00
Oli Scherer
4b7ae63fbf Use a dedicated type instead of a reference for the diagnostic context
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18 15:42:11 +00:00
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
Michael Goulet
7218fdd2db Fix other tools 2024-06-17 22:35:25 -04:00
Michael Goulet
61fc1aec74 Rework precise capturing syntax 2024-06-17 22:35:25 -04: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
Jason Newcomb
e18b310874 Add more types to is_from_proc_macro 2024-06-16 20:15:09 -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