Commit Graph

21098 Commits

Author SHA1 Message Date
Matthias Krüger
a1ff955721 Rollup merge of #132106 - maxcabrajac:ident_ref, r=petrochenkov
Pass Ident by reference in ast Visitor

`MutVisitor`'s version of `visit_ident` passes around `&Ident`, but `Visitor` copies `Ident`. This PR changes that

r? `@petrochenkov`

related to #128974
2024-10-25 20:33:11 +02:00
Ruairidh Williamson
59ecf4d073
Fix is_from_proc_macro attr 2024-10-25 15:25:17 +01:00
Jakub Beránek
3338611c1b
Switch CI from bors to merge queue 2024-10-25 10:28:45 +02:00
bors
9cf416dc6e Auto merge of #13586 - evanj:evan.jones/long-paragraph-edit, r=xFrednet
docs: Fix too_long_first_doc_paragraph: line -> paragraph

The documentation for too_long_first_doc_paragraph incorrectly says "line" where it should say "paragraph".

Fix a minor typo: doscstring -> docstring.

Also do a few tiny edits to attempt to make the wording slightly shorter and clearer.

changelog: [`too_long_first_doc_paragraph`]: Edit documentation
2024-10-24 19:29:29 +00:00
maxcabrajac
5d681cfe78 Pass Ident by reference in ast Visitor 2024-10-24 11:10:49 -03:00
bors
6bcd0b9b42 Auto merge of #13558 - alex-semenyuk:const_is_empty_fix, r=dswij
Don't trigger `const_is_empty` for inline const assertions

Close #13106

Considered case was described [here](https://github.com/rust-lang/rust-clippy/pull/13114#issuecomment-2266629991)

changelog: [`const_is_empty`]: skip const_is_empty for inline const assertions
2024-10-24 13:55:52 +00:00
Michael Goulet
eb6026a27f Remove associated type based effects logic 2024-10-24 09:46:36 +00:00
bors
c2534dcc49 Auto merge of #13460 - ROMemories:feat/freq-units-allowed-idents, r=Centri3
Add units/unit prefixes of frequency to doc-valid-idents

These units/unit prefixes often come up in the embedded world.

Should this PR also modify the `test_units` test? It seems only concerned with data units currently; should it also test frequency units?

changelog: [`doc_markdown`]: Add MHz, GHz, and THz to `doc-valid-idents`.
2024-10-24 08:50:36 +00:00
Samuel Tardieu
b0412d0dd7 borrow_deref_ref: do not trigger on &raw references 2024-10-24 09:03:15 +02:00
bors
cefa31a524 Auto merge of #13588 - GuillaumeGomez:fix-lint-anchor, r=flip1995
Fix not working lint anchor (generation and filtering)

As spotted by `@flip1995,` the anchor button is currently not working. Problem was the JS that was preventing the web browser from adding the hash at the end of the URL.

For the second bug fixed, the JS was stripping two characters instead of just stripping the `#` at the beginning.

changelog: Fix clippy page lint anchor (generation and filtering)

r? `@flip1995`
2024-10-23 19:12:16 +00:00
Guillaume Gomez
7115404a97 Open lint when clicking on its anchor 2024-10-23 16:58:06 +02:00
Ralf Jung
54f9bc4884 nightly feature tracking: get rid of the per-feature bool fields 2024-10-23 09:14:41 +01:00
Guillaume Gomez
b33977b852 Fix invalid lint ID filtering 2024-10-22 22:54:29 +02:00
Guillaume Gomez
97d13a8c0a Fix not working lint anchor 2024-10-22 22:50:17 +02:00
Evan Jones
0bcc6f8156
docs: Fix too_long_first_doc_paragraph: line -> paragraph
The documentation for too_long_first_doc_paragraph incorrectly says
"line" where it should say "paragraph".

Fix a minor typo: doscstring -> docstring.

Also do a few tiny edits to attempt to make the wording slightly
shorter and clearer.

changelog: Edit documentation for [`too_long_first_doc_paragraph`]
2024-10-22 16:04:30 -04:00
Michael Goulet
088f07a0a7 Represent TraitBoundModifiers as distinct parts in HIR 2024-10-22 19:48:44 +00:00
bors
78fc7bbfdd Auto merge of #131321 - RalfJung:feature-activation, r=nnethercote
terminology: #[feature] *enables* a feature (instead of "declaring" or "activating" it)

Mostly, we currently call a feature that has a corresponding `#[feature(name)]` attribute in the current crate a "declared" feature. I think that is confusing as it does not align with what "declaring" usually means. Furthermore, we *also* refer to `#[stable]`/`#[unstable]` as *declaring* a feature (e.g. in [these diagnostics](f25e5abea2/compiler/rustc_passes/messages.ftl (L297-L301))), which aligns better with what "declaring" usually means. To make things worse, the functions  `tcx.features().active(...)` and  `tcx.features().declared(...)` both exist and they are doing almost the same thing (testing whether a corresponding `#[feature(name)]`  exists) except that `active` would ICE if the feature is not an unstable lang feature. On top of this, the callback when a feature is activated/declared is called `set_enabled`, and many comments also talk about "enabling" a feature.

So really, our terminology is just a mess.

I would suggest we use "declaring a feature" for saying that something is/was guarded by a feature (e.g. `#[stable]`/`#[unstable]`), and "enabling a feature" for  `#[feature(name)]`. This PR implements that.
2024-10-22 11:02:35 +00:00
Ralf Jung
2fd8222bd4 terminology: #[feature] *enables* a feature (instead of "declaring" or "activating" it) 2024-10-22 07:37:54 +01:00
bors
f03f7c6c9d Auto merge of #129935 - RalfJung:unsupported_calling_conventions, r=compiler-errors
make unsupported_calling_conventions a hard error

This has been a future-compat lint (not shown in dependencies) since Rust 1.55, released 3 years ago. Hopefully that was enough time so this can be made a hard error now. Given that long timeframe, I think it's justified to skip the "show in dependencies" stage. There were [not many crates hitting this](https://github.com/rust-lang/rust/pull/86231#issuecomment-866300943) even when the lint was originally added.

This should get cratered, and I assume then it needs a t-compiler FCP. (t-compiler because this looks entirely like an implementation oversight -- for the vast majority of ABIs, we already have a hard error, but some were initially missed, and we are finally fixing that.)

Fixes https://github.com/rust-lang/rust/pull/87678
2024-10-22 03:24:40 +00:00
blyxyas
3773534f29 Move COGNITIVE_COMPLEXITY to use macro again 2024-10-21 19:27:34 +02:00
bors
5873cb9d17 Auto merge of #13570 - Kijewski:pr-stray-comma, r=xFrednet
docs: remove stray comma

changelog: none

the typo was (seemingly) ignored by browsers, so the change isn't visible to users
2024-10-21 09:11:08 +00:00
bors
8538562429 Auto merge of #13567 - y21:span_debug_assertions, r=flip1995
Add debug assertions for empty replacements and overlapping spans

rustc has debug assertions [^1] [^2] that check that a substitution doesn't have an empty suggestion string and an empty span at the same time, as well as that spans in multipart suggestions don't overlap.
However, since we link to the rustc-dev distributed compiler, these debug assertions are always disabled and so we never actually run them.

This leads to the problem that the debug ICE is not necessarily caught in the PR and only triggered in the rust repo sync, and in one of the last syncs this was a blocker and delayed the sync by several weeks because the fix was not obvious.

So this PR essentially copies the checks over and runs them in clippy debug builds as well, so that we can catch these errors in PRs directly.

-----
As for the second commit, this also *did* cause an ICE in a sync before and was fixed in the sync PR (see https://github.com/rust-lang/rust/pull/120345#issuecomment-1911005554), but it seems like that commit didn't make it back into the clippy repo (cc `@flip1995),` so the fixed code is in the rust repo but not in the clippy repo.

changelog: none

[^1]: https://doc.rust-lang.org/1.82.0/nightly-rustc/src/rustc_errors/diagnostic.rs.html#1019
[^2]: https://doc.rust-lang.org/1.82.0/nightly-rustc/src/rustc_errors/diagnostic.rs.html#932
2024-10-21 08:26:32 +00:00
bors
1d0dad5eb3 Auto merge of #131988 - matthiaskrgr:rollup-tx173wn, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #126588 (Added more scenarios where comma to be removed in the function arg)
 - #131728 (bootstrap: extract builder cargo to its own module)
 - #131968 (Rip out old effects var handling code from traits)
 - #131981 (Remove the `BoundConstness::NotConst` variant)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-21 06:13:34 +00:00
bors
d00ab2e955 Auto merge of #13569 - alex-semenyuk:fix_version, r=blyxyas
Fix version for `ref_option`

Close #13566
As mentioned at #13566 `ref_option` [was merged](https://github.com/rust-lang/rust-clippy/pull/13336) after 1.82.0 so it wasn't include in this version

changelog: none
2024-10-20 22:20:55 +00:00
y21
b3bf128e54 don't lint nested items that don't have generated documentation in missing_docs_in_private_items 2024-10-20 23:42:28 +02:00
y21
2f71ce6651 don't lint unnamed constants in missing_docs_in_private_items 2024-10-20 22:14:02 +02:00
Alex Macleod
2666ed6c5b Fix indentation of website code snippets 2024-10-20 19:02:40 +00:00
y21
65eb1ec0fb remove the semicolon for builtin macro call statements in statement_outside_block
The expansion of `asm!()` and `line!()` is not marked as from an expansion, in which case `SourceMap::stmt_span` returns the input span unchanged. So instead of using `stmt_span`, use `mac_call_stmt_semi_span` directly
2024-10-20 19:00:55 +02:00
Michael Goulet
d8b2f9364d Rip out old effects var handling code from traits 2024-10-20 13:40:22 +00:00
Ralf Jung
aab0eee4ef make unsupported_calling_conventions a hard error 2024-10-20 15:22:21 +02:00
René Kijewski
2a5de352a1 docs: remove stray comma 2024-10-20 14:47:01 +02:00
alexey semenyuk
64c4cf1cba
Fix version for ref_option 2024-10-20 14:43:32 +05:00
Michael Goulet
69b088626c Fix tests 2024-10-19 18:07:35 +00:00
y21
4de65a113f fix empty suggestion ICE in from_over_into 2024-10-19 19:24:09 +02:00
y21
38cf3f3234 add debug assertions for overlapping spans and empty replacements 2024-10-19 19:23:56 +02:00
blyxyas
e518d66dc0 Apply review comments + use shallow_lint_levels_on 2024-10-19 16:20:52 +02:00
blyxyas
e427a4e694 Remove module passes filtering 2024-10-19 16:20:51 +02:00
blyxyas
8f8aa46a87 Follow review comments (optimize the filtering) 2024-10-19 16:20:33 +02:00
blyxyas
698363122e Do not run lints that cannot emit
Before this change, adding a lint was a difficult matter
because it always had some overhead involved. This was
because all lints would run, no matter their default level,
or if the user had #![allow]ed them. This PR changes that
2024-10-19 16:19:44 +02:00
bors
5678531c6d Auto merge of #13564 - GnomedDev:fix-manualbits-in-macro, r=blyxyas
Stop linting manual_bits in any macro invoke

Closes #13563.

changelog: [`manual_bits`] No longer lints in macro-generated code
2024-10-19 14:09:28 +00:00
bors
f2f0175eb2 Auto merge of #13543 - GnomedDev:symbol-comparisons, r=y21
Add internal lint to check for slow symbol comparisons

See the conversation on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Checking.20a.20Symbol.20is.20equal.20to.20a.20string.20literal).

changelog: none
2024-10-18 23:20:38 +00:00
GnomedDev
a739cc3abe
Stop linting manual_bits in any macro invoke 2024-10-18 21:41:05 +01:00
bors
6a795887c4 Auto merge of #13539 - GuillaumeGomez:allow-no-js, r=Alexendoo
Allow to go through clippy lints page without javascript

Fixes #13536.

This is the follow-up of https://github.com/rust-lang/rust-clippy/pull/13269.

This PR makes it possible to expand/collapse lints (individually) without JS. To achieve this result, there are two ways:
1. Use `details` and `summary` tags. Problem with this approach is that the web browser search may open the `details` tags automatically if content matching it is inside. From a previous discussion with `@Alexendoo,` it seems to not be a desired behaviour.
2. Use a little trick where you use a `label` and a checkbox where the checkbox is in fact hidden. Then it's just a matter of CSS.

r? `@Alexendoo`

changelog: Allow to go through clippy lints page without JS
2024-10-18 19:24:16 +00:00
bors
47effe4f68 Auto merge of #13562 - klensy:pc, r=flip1995
pulldown-cmark: don't pull getopts dep

Don't pull getopts, as it unused. Noticed in https://github.com/rust-lang/rust/pull/131892

changelog: none
2024-10-18 16:27:41 +00:00
Guillaume Gomez
da19d47147 Fix lints syntax highlighting 2024-10-18 18:03:16 +02:00
Guillaume Gomez
82969e5c4e Allow to go through clippy lints page without javascript 2024-10-18 18:03:16 +02:00
klensy
2c3a34a040 pulldown-cmark: don't pull getopts dep 2024-10-18 17:08:50 +03:00
Philipp Krones
91a458f451 Hotfix TRAIT_METHODS static->const 2024-10-18 14:54:06 +02:00
Philipp Krones
fea5e77da1 Merge commit 'a109190d7060236e655fc75533373fa274ec5343' into clippy-subtree-update 2024-10-18 13:44:06 +02:00
bors
a109190d70 Auto merge of #13561 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-10-18 11:31:05 +00:00