rust-clippy/tests
bors 62dcbd672b Auto merge of #12177 - y21:issue12154, r=Jarcho
[`unconditional_recursion`]: compare by `Ty`s instead of `DefId`s

Fixes #12154
Fixes #12181 (this was later edited in, so the rest of the description refers to the first linked issue)

Before this change, the lint would work with `DefId`s and use those to compare types. This PR changes it to compare types directly. It fixes the linked issue, but also other false positives I found in a lintcheck run. For example, one of the issues is that some types don't have `DefId`s (primitives, references, etc., leading to possible FNs), and the helper function used to extract a `DefId` didn't handle type parameters.

Another issue was that the lint would use `.peel_refs()` in a few places where that could lead to false positives (one such FP was in the `http` crate). See the doc comment on one of the added functions and also the test case for what I mean.

The code in the linked issue was linted because the receiver type is `T` (a `ty::Param`), which was not handled in `get_ty_def_id` and returned `None`, so this wouldn't actually *get* to comparing `self_arg != ty_id` here, and skip the early-return:
70573af31e/clippy_lints/src/unconditional_recursion.rs (L171-L178)

This alone could be fixed by doing something like `&& get_ty_def_id(ty).map_or(true, |ty_id)| self_arg != ty_id)`, but we don't really need to work with `DefId`s in the first place, I don't think.

changelog: [`unconditional_recursion`]: avoid linting when the other comparison type is a type parameter
2024-02-07 16:18:33 +00:00
..
test_utils
ui Auto merge of #12177 - y21:issue12154, r=Jarcho 2024-02-07 16:18:33 +00:00
ui-cargo Add lint_groups_priority lint 2024-01-31 18:33:41 +00:00
ui-internal Merge remote-tracking branch 'upstream/master' into rustup 2024-01-25 18:39:39 +01:00
ui-toml rename conf option to allowed_wildcard_imports 2024-02-02 09:22:42 +08:00
workspace_test Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyup 2023-07-02 14:59:02 +02:00
check-fmt.rs
clippy.toml
compile-test.rs Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyup 2023-11-02 17:35:56 +01:00
dogfood.rs Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyup 2023-11-02 17:35:56 +01:00
headers.rs Merge commit 'a859e5cc1ce100df22346a1005da30532d04de59' into clippyup 2023-12-16 14:12:50 +01:00
integration.rs Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug. 2023-12-02 09:01:19 +11:00
lint_message_convention.rs Merge commit 'd9c24d1b1ee61f276e550b967409c9f155eac4e3' into clippyup 2023-07-17 10:22:32 +02:00
missing-test-files.rs Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyup 2023-07-02 14:59:02 +02:00
versioncheck.rs Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyup 2023-11-02 17:35:56 +01:00
workspace.rs Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyup 2023-07-02 14:59:02 +02:00