about summary refs log tree commit diff
path: root/src/tools/clippy/tests
AgeCommit message (Collapse)AuthorLines
2023-08-23Fix clippy lint for identical `if`/`else` contraining `?` expressionsEsteban Küber-2/+21
Follow up to #114819.
2023-08-17Auto merge of #11314 - GuillaumeGomez:needless_ref_mut_async_block, r=Centri3bors-1/+48
Correctly handle async blocks for NEEDLESS_PASS_BY_REF_MUT Fixes https://github.com/rust-lang/rust-clippy/issues/11299. The problem was that the `async block`s are popping a closure which we didn't go into, making it miss the mutable access to the variables. cc `@Centri3` changelog: none
2023-08-17Auto merge of #11070 - y21:issue11065, r=flip1995bors-10/+57
[`useless_conversion`]: only lint on paths to fn items and fix FP in macro Fixes #11065 (which is actually two issues: an ICE and a false positive) It now makes sure that the function call path points to a function-like item (and not e.g. a `const` like in the linked issue), so that calling `TyCtxt::fn_sig` later in the lint does not ICE (fixes https://github.com/rust-lang/rust-clippy/issues/11065#issuecomment-1616836099). It *also* makes sure that the expression is not part of a macro call (fixes https://github.com/rust-lang/rust-clippy/issues/11065#issuecomment-1616919639). ~~I'm not sure if there's a better way to check this other than to walk the parent expr chain and see if any of them are expansions.~~ (edit: it doesn't do this anymore) changelog: [`useless_conversion`]: fix ICE when call receiver is a non-fn item changelog: [`useless_conversion`]: don't lint if argument is a macro argument (fixes a FP) r? `@llogiq` (reviewed #10814, which introduced these issues)
2023-08-14bless clippy testEsteban Küber-21/+2
2023-08-11Merge commit '1e8fdf492808a25d78a97e1242b835ace9924e4d' into clippyupPhilipp Krones-132/+846
2023-08-10Revert "New lint [`filter_map_bool_then`]"Catherine Flores-122/+0
This reverts commits 978b1daf99d8326718684381704902fdaaf71b18 and 3235d9d612909bc64550eea3a0d387e1187e93dd.
2023-08-03Auto merge of #108955 - Nilstrieb:dont-use-me-pls, r=oli-obkbors-0/+1
Add `internal_features` lint Implements https://github.com/rust-lang/compiler-team/issues/596 Also requires some more test blessing for codegen tests etc `@jyn514` had the idea of just `allow`ing the lint by default in the test suite. I'm not sure whether this is a good idea, but it's definitely one worth considering. Additional input encouraged.
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-08-01Rename incorrect_fn_null_checks to useless_ptr_null_checks (clippy side)Urgau-5/+5
2023-07-31Merge commit '5436dba826191964ac1d0dab534b7eb6d4c878f6' into clippyupPhilipp Krones-634/+4092
2023-07-30Rollup merge of #112655 - WaffleLapkin:must_use_map_or, r=workingjubileeMatthias Krüger-2/+2
Mark `map_or` as `#[must_use]` I don't know what else to say. r? libs
2023-07-30Mark `map_or` as `#[must_use]`Maybe Waffle-2/+2
2023-07-29Auto merge of #113422 - Urgau:cast_ref_to_mut-pre-beta, r=Nilstriebbors-5/+5
Rename and allow `cast_ref_to_mut` lint This PR is a small subset of https://github.com/rust-lang/rust/pull/112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`). BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until https://github.com/rust-lang/rust/pull/112431 is merged. r? `@Nilstrieb`
2023-07-29Auto merge of #111916 - fee1-dead-contrib:noop-method-call-warn, ↵bors-12/+14
r=compiler-errors make `noop_method_call` warn by default r? `@compiler-errors`
2023-07-28Auto merge of #114134 - fee1-dead-contrib:rm-constness-from-param-env, r=oli-obkbors-7/+2
Remove `constness` from `ParamEnv` This should be replaced by keyword generics/effects. cc #110395 r? `@oli-obk`
2023-07-27bless clippyDeadbeef-7/+2
2023-07-26Unite bless environment variables under `RUSTC_BLESS`Trevor Gross-1/+3
Currently, Clippy, Miri, Rustfmt, and rustc all use an environment variable to indicate that output should be blessed, but they use different variable names. In order to improve consistency, this patch applies the following changes: - Emit `RUSTC_BLESS` within `prepare_cargo_test` so it is always available - Change usage of `MIRI_BLESS` in the Miri subtree to use `RUSTC_BLESS` - Change usage of `BLESS` in the Clippy subtree to `RUSTC_BLESS` - Change usage of `BLESS` in the Rustfmt subtree to `RUSTC_BLESS` - Adjust the blessable test in `rustc_errors` to use this same convention - Update documentation where applicable Any tools that uses `RUSTC_BLESS` should check that it is set to any value other than `"0"`.
2023-07-25bless moreRalf Jung-4/+4
2023-07-23fixDeadbeef-12/+14
2023-07-17Merge commit 'd9c24d1b1ee61f276e550b967409c9f155eac4e3' into clippyupPhilipp Krones-1378/+2933
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-3/+3
2023-07-13Rename cast_ref_to_mut to invalid_reference_casting (clippy side)Urgau-5/+5
2023-07-12Ignore flaky clippy tests.Eric Huss-0/+9
2023-07-11Auto merge of #111717 - Urgau:uplift_fn_null_check, r=oli-obkbors-118/+63
Uplift `clippy::fn_null_check` lint This PR aims at uplifting the `clippy::fn_null_check` lint into rustc. ## `incorrect_fn_null_checks` (warn-by-default) The `incorrect_fn_null_checks` lint checks for expression that checks if a function pointer is null. ### Example ```rust let fn_ptr: fn() = /* somehow obtained nullable function pointer */ if (fn_ptr as *const ()).is_null() { /* ... */ } ``` ### Explanation Function pointers are assumed to be non-null, checking for their nullity is incorrect. ----- Mostly followed the instructions for uplifting a clippy lint described here: https://github.com/rust-lang/rust/pull/99696#pullrequestreview-1134072751 `@rustbot` label: +I-lang-nominated r? compiler
2023-07-10Drop uplifted `clippy::fn_null_check`Urgau-118/+63
2023-07-08Delete `to_string_in_format_args_incremental.rs`Nilstrieb-19/+0
It fails CI and passes locally. It passes random directores in `-Cincremental` so maybe something's up. It shouldn't block us here.
2023-07-07Fix failing clippy testsAlex Macleod-40/+20
Comments out the C string literals due to https://github.com/rust-lang/rust/pull/113334 Fixes https://github.com/rust-lang/rust-clippy/issues/11121
2023-07-02Fix compile-test tests to work with the new ui_test cratePhilipp Krones-9/+3
2023-07-02Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyupPhilipp Krones-4122/+15190
2023-06-26Make simd_shuffle_indices use valtreesOli Scherer-0/+12
2023-06-25Do not offer any of the suggestions in emit_coerce_suggestions for expr from ↵yukang-5/+0
destructuring assignment desugaring
2023-06-21Auto merge of #106450 - albertlarsan68:fix-arc-ptr-eq, r=Amanieubors-23/+7
Make `{Arc,Rc,Weak}::ptr_eq` ignore pointer metadata FCP completed in https://github.com/rust-lang/rust/issues/103763#issuecomment-1362267967 Closes #103763
2023-06-18Treat TAIT equation as always ambiguous in coherenceMichael Goulet-14/+25
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-76/+50
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-15Extend `unused_must_use` to cover block exprs许杰友 Jieyou Xu (Joe)-26/+28
2023-06-10Drop uplifted `clippy:cmp_nan`Urgau-242/+69
2023-06-08Drop uplifted clippy::undropped_manually_dropsUrgau-96/+61
2023-06-02Auto merge of #112203 - flip1995:clippyup, r=Manishearthbors-357/+2069
Update Clippy r? `@Manishearth`
2023-06-02Merge commit '30448e8cf98d4754350db0c959644564f317bc0f' into clippyupPhilipp Krones-357/+2069
2023-06-02Auto merge of #112198 - compiler-errors:rollup-o2xe4of, r=compiler-errorsbors-13/+15
Rollup of 7 pull requests Successful merges: - #111670 (Require that const param tys implement `ConstParamTy`) - #111914 (CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…) - #112030 (Migrate `item_trait_alias` to Askama) - #112150 (Support 128-bit atomics on all x86_64 Apple targets) - #112174 (Fix broken link) - #112190 (Improve comments on `TyCtxt` and `GlobalCtxt`.) - #112193 (Check tuple elements are `Sized` in `offset_of`) Failed merges: - #112071 (Group rfcs tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-01Implement custom diagnostic for ConstParamTyMichael Goulet-13/+15
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-3/+3
2023-05-31Drop uplifted clippy::cast_ref_to_mutUrgau-103/+60
2023-05-27Drop uplifted clippy::invalid_utf8_in_uncheckedUrgau-91/+59
2023-05-21Rename `forget_ref` lint to `forgetting_references`Urgau-5/+5
2023-05-21Rename `drop_ref` lint to `dropping_references`Urgau-5/+5
2023-05-21Rename `forget_copy` lint to `forgetting_copy_types`Urgau-6/+6
2023-05-21Rename `drop_copy` lint to `dropping_copy_types`Urgau-6/+6
2023-05-20Merge commit '435a8ad86c7a33bd7ffb91c59039943408d3b6aa' into clippyupPhilipp Krones-548/+1331
2023-05-17Exclude inherent projections from some alias ty matchesLeón Orell Valerian Liehr-0/+13