summary refs log tree commit diff
path: root/src/tools/clippy/tests
AgeCommit message (Collapse)AuthorLines
2025-06-20Fix ICE in `missing_const_for_fn` (rust-lang/rust-clippy#14776)Alejandra González-0/+43
The `mir_drops_elaborated_and_const_checked` query result has been stolen already and cannot be borrowed again. Use the `optimized_mir` query result instead. changelog: [`missing_const_for_fn`]: fix ICE with some compilation options Fixes rust-lang/rust-clippy#14774 r? @Jarcho
2025-06-20`needless_borrow`: do not contradict `dangerous_implicit_autorefs` ↵Alejandra González-22/+40
(rust-lang/rust-clippy#14810) Rust 1.88 introduces the `dangerous_implicit_autorefs` lint which warns about using implicit autorefs on a place obtained from a raw pointer, as this may create aliasing issues. Prevent `clippy::needless_borrow` from triggering in this case, by disabling the lint when taking a reference on a raw pointer dereference. There might be a better way for doing this in the long run with a finer way of distinguish the problematic cases, but this will prevent Clippy from contradicting the compiler in the meantime. Fixes rust-lang/rust-clippy#14743 changelog: [`needless_borrow`]: do not contradict the compiler's `dangerous_implicit_autorefs` lint even though the refererences are not mandatory @rustbot label +beta-nominated <!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_SUMMARY_START --> - [Beta nomination for 1.88](https://github.com/rust-lang/rust-clippy/pull/14810#issuecomment-2883753957) by [samueltardieu](https://github.com/samueltardieu) Generated by triagebot, see [help](https://forge.rust-lang.org/triagebot/note.html) for how to add more <!-- TRIAGEBOT_SUMMARY_DATA_START$${"entries_by_url":{"https://github.com/rust-lang/rust-clippy/pull/14810#issuecomment-2883753957":{"title":"Beta nomination for 1.88","comment_url":"https://github.com/rust-lang/rust-clippy/pull/14810#issuecomment-2883753957","author":"samueltardieu"}}}$$TRIAGEBOT_SUMMARY_DATA_END --> <!-- TRIAGEBOT_SUMMARY_END --> <!-- TRIAGEBOT_END -->
2025-06-20remove superseded lints (rust-lang/rust-clippy#14703)Samuel Tardieu-759/+108
changelog: [`transmute_float_to_int, transmute_int_to_char, transmute_int_to_float`, `transmute_num_to_bytes`]: remove lints, now in rustc these lints are now mostly in rustc, so they dont need to be in clippy anymore https://github.com/rust-lang/rust/pull/136083#discussion_r2009897120 pending https://github.com/rust-lang/rust/pull/140431: transmute_int_to_bool <!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_SUMMARY_START --> - ["Rust version of new lints should be checked" by @samueltardieu](https://github.com/rust-lang/rust-clippy/pull/14703#issuecomment-2861982576) Generated by triagebot, see [help](https://forge.rust-lang.org/triagebot/note.html) for how to add more <!-- TRIAGEBOT_SUMMARY_DATA_START$${"entries_by_url":{"https://github.com/rust-lang/rust-clippy/pull/14703#issuecomment-2861982576":{"title":"Rust version of new lints should be checked","comment_url":"https://github.com/rust-lang/rust-clippy/pull/14703#issuecomment-2861982576","author":"samueltardieu"}}}$$TRIAGEBOT_SUMMARY_DATA_END --> <!-- TRIAGEBOT_SUMMARY_END --> <!-- TRIAGEBOT_END -->
2025-06-20Fix `collapsible_if` FP on block stmt before expr (rust-lang/rust-clippy#14730)Samuel Tardieu-0/+22
Closes rust-lang/rust-clippy#14722 changelog: [`collapsible_if`] fix FP on block stmt before expr
2025-06-20Don't warn about unloaded crates (rust-lang/rust-clippy#14733)Alex Macleod-0/+32
Fixes https://github.com/rust-lang/rust-clippy/pull/14397#issuecomment-2848328221 r? @samueltardieu changelog: Don't warn about clippy.toml disallowed paths for crates that were not loaded
2025-05-06Rollup merge of #139773 - thaliaarchi:vec-into-iter-last, r=workingjubileeStuart Cook-7/+46
Implement `Iterator::last` for `vec::IntoIter` Avoid iterating everything when we have random access to the last element.
2025-05-06Auto merge of #131160 - ↵bors-30/+30
ismailarilik:handle-potential-query-instability-lint-for-rustc-middle, r=oli-obk Handle `rustc_middle` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_middle/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/lib.rs#L29) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: https://github.com/rust-lang/rust/issues/84447 r? `@compiler-errors`
2025-05-05Handle rustc_middle cases of rustc::potential_query_instability lintismailarilik-30/+30
2025-05-02Implement Iterator::last for vec::IntoIterThalia Archibald-7/+46
2025-05-01Merge commit '03a5b6b976ac121f4233775c49a4bce026065b47' into ↵Philipp Krones-195/+1243
clippy-subtree-update
2025-04-26Fix error message for static references or mutable referencesyuk1ty-1/+1
2025-04-24Suggest {to,from}_ne_bytes for transmutations between arrays and integers, etcbendn-66/+79
2025-04-22Merge commit '0621446356e20fd2ead13a6763bb936c95eb0cfa' into ↵Philipp Krones-2709/+8010
clippy-subtree-update
2025-03-30Drop `clippy::invalid_null_ptr_usage`Urgau-575/+21
2025-03-20Merge commit '1e5237f4a56ae958af7e5824343eacf737b67083' into ↵Philipp Krones-503/+3105
clippy-subtree-update
2025-03-14Do not suggest using `-Zmacro-backtrace` for builtin macrosEsteban Küber-16/+0
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-11/+5
2025-02-28Clippy: skip check_host_compiler check in rustc testsuitePhilipp Krones-0/+5
This test only makes sense to run in the Clippy repo In the Rust repo the name of the host_compiler is dev, not nightly
2025-02-28Merge commit '9f9a822509e5ad3e560cbbe830d1013f936fca28' into ↵Philipp Krones-14004/+31921
clippy-subtree-update
2025-02-24simplify must-use lint slightlyJana Dönszelmann-29/+40
2025-02-24Fix rustdoc and clippyJana Dönszelmann-13/+15
2025-02-21Trim suggestion part before generating highlightsMichael Goulet-24/+20
2025-02-21More sophisticated span trimmingMichael Goulet-121/+80
2025-02-17Move some `Map` methods onto `TyCtxt`.Nicholas Nethercote-4/+4
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-29/+18
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-1500/+2292
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-02-07add tests for spurious failure and fix typoJana Dönszelmann-21/+49
2025-02-07fix empty after lint on impl/trait itemsJonathan Dönszelmann-1/+40
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-02-07Update UI testsGuillaume Gomez-24/+26
2025-02-06Merge commit '3e3715c31236bff56f1c63a1de2c7bbdfcfb0923' into ↵Philipp Krones-249/+1527
clippy-subtree-update
2025-01-28Merge commit '51d49c1ae2785b24ef18a46ef233fc1d91844666' into ↵Philipp Krones-364/+4048
clippy-subtree-update
2025-01-26remove `clippy::double_neg`Kalle Wachsmuth-95/+82
2025-01-21Auto merge of #134299 - RalfJung:remove-start, r=compiler-errorsbors-185/+37
remove support for the (unstable) #[start] attribute As explained by `@Noratrieb:` `#[start]` should be deleted. It's nothing but an accidentally leaked implementation detail that's a not very useful mix between "portable" entrypoint logic and bad abstraction. I think the way the stable user-facing entrypoint should work (and works today on stable) is pretty simple: - `std`-using cross-platform programs should use `fn main()`. the compiler, together with `std`, will then ensure that code ends up at `main` (by having a platform-specific entrypoint that gets directed through `lang_start` in `std` to `main` - but that's just an implementation detail) - `no_std` platform-specific programs should use `#![no_main]` and define their own platform-specific entrypoint symbol with `#[no_mangle]`, like `main`, `_start`, `WinMain` or `my_embedded_platform_wants_to_start_here`. most of them only support a single platform anyways, and need cfg for the different platform's ways of passing arguments or other things *anyways* `#[start]` is in a super weird position of being neither of those two. It tries to pretend that it's cross-platform, but its signature is a total lie. Those arguments are just stubbed out to zero on ~~Windows~~ wasm, for example. It also only handles the platform-specific entrypoints for a few platforms that are supported by `std`, like Windows or Unix-likes. `my_embedded_platform_wants_to_start_here` can't use it, and neither could a libc-less Linux program. So we have an attribute that only works in some cases anyways, that has a signature that's a total lie (and a signature that, as I might want to add, has changed recently, and that I definitely would not be comfortable giving *any* stability guarantees on), and where there's a pretty easy way to get things working without it in the first place. Note that this feature has **not** been RFCed in the first place. *This comment was posted [in May](https://github.com/rust-lang/rust/issues/29633#issuecomment-2088596042) and so far nobody spoke up in that issue with a usecase that would require keeping the attribute.* Closes https://github.com/rust-lang/rust/issues/29633 try-job: x86_64-gnu-nopt try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: test-various
2025-01-21remove support for the #[start] attributeRalf Jung-185/+37
2025-01-15Rollup merge of #135003 - RalfJung:deprecate-allowed-through-unstable, ↵Guillaume Gomez-31/+31
r=davidtwco deprecate `std::intrinsics::transmute` etc, use `std::mem::*` instead The `rustc_allowed_through_unstable_modules` attribute lets users call `std::mem::transmute` as `std::intrinsics::transmute`. The former is a reexport of the latter, and for a long time we didn't properly check stability for reexports, so making this a hard error now would be a breaking change for little gain. But at the same time, `std::intrinsics::transmute` is not the intended path for this function, so I think it is a good idea to show a deprecation warning when that path is used. This PR implements that, for all the functions in `std::intrinsics` that carry the attribute. I assume this will need ``@rust-lang/libs-api`` FCP.
2025-01-15Rollup merge of #132397 - m-ou-se:warn-missing-abi, r=NadrierilJacob Pratt-12/+15
Make missing_abi lint warn-by-default. This makes the missing_abi lint warn-by-default, as suggested here: https://github.com/rust-lang/rfcs/pull/3722#issuecomment-2447719047 This needs a lang FCP.
2025-01-15intrinsics: deprecate calling them via the unstable std::intrinsics pathRalf Jung-31/+31
2025-01-09Merge commit '19e305bb57a7595f2a8d81f521c0dd8bf854e739' into ↵Philipp Krones-190/+1291
clippy-subtree-update
2025-01-08Rename PatKind::Lit to ExprOli Scherer-6/+6
2025-01-08Exhaustively handle expressions in patternsOli Scherer-6/+6
2025-01-07Update tests.Mara Bos-12/+15
2025-01-03turn rustc_box into an intrinsicRalf Jung-9/+8
2024-12-26Merge commit '609cd310be44677ae31d452a17b0f8207e1abfe1' into ↵Philipp Krones-794/+4578
clippy-subtree-update
2024-12-15Auto merge of #134258 - bjorn3:no_public_specialization, r=petrochenkovbors-56/+1
Remove support for specializing ToString outside the standard library This is the only trait specializable outside of the standard library. Before stabilizing specialization we will probably want to remove support for this. It was originally made specializable to allow a more efficient ToString in libproc_macro back when this way the only way to get any data out of a TokenStream. We now support getting individual tokens, so proc macros no longer need to call it as often.
2024-12-14Stop handling specialization in clippy's to_string_trait_impl lintbjorn3-56/+1
ToString can no longer be specialized, so no need to account for it in to_string_trait_impl either.
2024-12-14Rollup merge of #134181 - estebank:trim-render, r=oli-obkMatthias Krüger-155/+32
Tweak multispan rendering to reduce output length Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments. We do that check not only on the first 4 lines of the multispan, but now also on the previous to last line as well.
2024-12-13Account for `///` when rendering multiline spansEsteban Küber-10/+31
Don't consider `///` and `//!` docstrings to be empty for the purposes of multiline span rendering.
2024-12-13Stabilize async closuresMichael Goulet-51/+45
2024-12-12Filter empty lines, comments and delimiters from previous to last multiline ↵Esteban Küber-69/+4
span rendering
2024-12-12Tweak multispan renderingEsteban Küber-117/+38
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.