summary refs log tree commit diff
path: root/src/tools/clippy/tests
AgeCommit message (Collapse)AuthorLines
2023-03-03Fix array-size-threshold config deserialization errorAlex Macleod-14/+10
2023-01-13Auto merge of #106801 - JohnTitor:rollup-xqkraw0, r=JohnTitorbors-3/+6
Rollup of 6 pull requests Successful merges: - #106608 (Render missing generics suggestion verbosely) - #106716 ([RFC 2397] Deny incorrect locations) - #106754 (Rename `Ty::is_ty_infer` -> `Ty::is_ty_or_numeric_infer`) - #106782 (Ignore tests move in git blame) - #106785 (Make blame spans better for impl wfcheck) - #106791 (Fix ICE formatting) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-13Rollup merge of #106608 - compiler-errors:missing-generics-verbose, r=estebankYuki Okushi-3/+6
Render missing generics suggestion verbosely It's a bit easier to read like this, especially ones that are appending new generics onto an existing list, like ": `, T`" which render somewhat poorly inline. Also don't suggest `dyn` as a type parameter to add, even if technically that's valid in edition 2015.
2023-01-13Auto merge of #106092 - asquared31415:start_lang_item_checks, r=davidtwcobors-1/+1
Add checks for the signature of the `start` lang item Closes #105963
2023-01-12Don't suggest dyn as parameter to addMichael Goulet-3/+6
2023-01-12Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyupPhilipp Krones-454/+1343
2023-01-11add checks for the signature of the lang itemasquared31415-1/+1
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-3/+3
2022-12-29Rollup merge of #106259 - flip1995:clippyup, r=matthiaskrgrMatthias Krüger-96/+1909
Update Clippy r? `@Manishearth` I think this was the very first sync with no conflicts whatsoever. I love this time of the year :D
2022-12-29Account for multiple multiline spans with empty paddingEsteban Küber-8/+3
Instead of ``` LL | fn oom( | __^ | | _| | || LL | || ) { | ||_- LL | | } | |__^ ``` emit ``` LL | // fn oom( LL | || ) { | ||_- LL | | } | |__^ ```
2022-12-29Merge commit '4f3ab69ea0a0908260944443c739426cc384ae1a' into clippyupPhilipp Krones-96/+1909
2022-12-19Make Clippy test no longer unsoundMichael Goulet-1/+1
2022-12-17Merge commit '4bdfb0741dbcecd5279a2635c3280726db0604b5' into clippyupPhilipp Krones-300/+1819
2022-12-02Auto merge of #104963 - petrochenkov:noaddids2, r=cjgillotbors-4/+4
rustc_ast_lowering: Stop lowering imports into multiple items Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-01Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyupPhilipp Krones-1145/+1920
2022-12-01rustc_ast_lowering: Stop lowering imports into multiple itemsVadim Petrochenkov-4/+4
Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-11-28fix clippy testsEsteban Küber-13/+13
2022-11-24Avoid `GenFuture` shim when compiling async constructsArpad Borsos-1/+1
Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through.
2022-11-21Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyupPhilipp Krones-736/+3917
2022-11-17Add variant_name function to `LangItem`Philipp Krones-16/+16
Clippy has an internal lint that checks for the usage of hardcoded def paths and suggests to replace them with a lang or diagnostic item, if possible. This was implemented with a hack, by getting all the variants of the `LangItem` enum and then index into it with the position of the `LangItem` in the `items` list. This is no longer possible, because the `items` list can't be accessed anymore.
2022-11-16cleanup and dedupe CTFE and Miri error reportingRalf Jung-3/+3
2022-11-09bless clippyyukang-0/+5
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-0/+22
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-10-26Adjust normalizationmejrs-3/+3
2022-10-24Add more normalization and testsmejrs-2/+6
2022-10-24Address some commentsmejrs-0/+18
2022-10-23Merge commit '4f142aa1058f14f153f8bfd2d82f04ddb9982388' into clippyupflip1995-1291/+3975
2022-10-21Rollup merge of #103260 - cuviper:needs-asm-support, r=fee1-deadDylan DPC-34/+37
Fixup a few tests needing asm support
2022-10-20Implement assertions and fixes to not emit empty spans without suggestionsKevin Per-94/+16
2022-10-19Fixup a few tests needing asm supportJosh Stone-34/+37
2022-10-10Rollup merge of #99696 - WaffleLapkin:uplift, r=fee1-deadDylan DPC-189/+30
Uplift `clippy::for_loops_over_fallibles` lint into rustc This PR, as the title suggests, uplifts [`clippy::for_loops_over_fallibles`] lint into rustc. This lint warns for code like this: ```rust for _ in Some(1) {} for _ in Ok::<_, ()>(1) {} ``` i.e. directly iterating over `Option` and `Result` using `for` loop. There are a number of suggestions that this PR adds (on top of what clippy suggested): 1. If the argument (? is there a better name for that expression) of a `for` loop is a `.next()` call, then we can suggest removing it (or rather replacing with `.by_ref()` to allow iterator being used later) ```rust for _ in iter.next() {} // turns into for _ in iter.by_ref() {} ``` 2. (otherwise) We can suggest using `while let`, this is useful for non-iterator, iterator-like things like [async] channels ```rust for _ in rx.recv() {} // turns into while let Some(_) = rx.recv() {} ``` 3. If the argument type is `Result<impl IntoIterator, _>` and the body has a `Result<_, _>` type, we can suggest using `?` ```rust for _ in f() {} // turns into for _ in f()? {} ``` 4. To preserve the original behavior and clear intent, we can suggest using `if let` ```rust for _ in f() {} // turns into if let Some(_) = f() {} ``` (P.S. `Some` and `Ok` are interchangeable depending on the type) I still feel that the lint wording/look is somewhat off, so I'll be happy to hear suggestions (on how to improve suggestions :D)! Resolves #99272 [`clippy::for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles
2022-10-09deprecate `clippy::for_loops_over_fallibles`Maybe Waffle-189/+28
2022-10-09fixup lint nameMaybe Waffle-2/+2
2022-10-09Fix clippy tests that trigger `for_loop_over_fallibles` lintMaybe Waffle-1/+3
2022-10-08Stabilize half_open_range_patternsUrgau-1/+1
2022-10-07make const_err a hard errorRalf Jung-6/+12
2022-10-06Merge commit '8f1ebdd18bdecc621f16baaf779898cc08cc2766' into clippyupPhilipp Krones-55/+12
2022-10-06Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyupPhilipp Krones-1397/+5485
2022-10-01bless clippyMaybe Waffle-231/+231
2022-09-27rustc_typeck to rustc_hir_analysislcnr-2/+2
2022-09-26Rollup merge of #102197 - Nilstrieb:const-new-🌲, r=Mark-Simulacrumfee1-dead-3/+3
Stabilize const `BTree{Map,Set}::new` The FCP was completed in #71835. Since `len` and `is_empty` are not const stable yet, this also creates a new feature for them since they previously used the same `const_btree_new` feature.
2022-09-23Stabilize const `BTree{Map,Set}::new`Nilstrieb-3/+3
Since `len` and `is_empty` are not const stable yet, this also creates a new feature for them since they previously used the same `const_btree_new` feature.
2022-09-23Bless clippy.Camille GILLOT-11/+11
2022-09-21Merge commit '7248d06384c6a90de58c04c1f46be88821278d8b' into sync-from-clippyDavid Koloski-818/+1324
2022-09-15Fix clippyest31-45/+42
2022-09-09Merge commit 'b52fb5234cd7c11ecfae51897a6f7fa52e8777fc' into clippyupPhilipp Krones-194/+900
2022-09-06Auto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillotbors-8/+8
`BindingAnnotation` refactor * `ast::BindingMode` is deleted and replaced with `hir::BindingAnnotation` (which is moved to `ast`) * `BindingAnnotation` is changed from an enum to a tuple struct e.g. `BindingAnnotation(ByRef::No, Mutability::Mut)` * Associated constants added for convenience `BindingAnnotation::{NONE, REF, MUT, REF_MUT}` One goal is to make it more clear that `BindingAnnotation` merely represents syntax `ref mut` and not the actual binding mode. This was especially confusing since we had `ast::BindingMode`->`hir::BindingAnnotation`->`thir::BindingMode`. I wish there were more symmetry between `ByRef` and `Mutability` (variant) naming (maybe `Mutable::Yes`?), and I also don't love how long the name `BindingAnnotation` is, but this seems like the best compromise. Ideas welcome.
2022-09-05separate the receiver from arguments in HIR under /clippyTakayuki Maeda-3/+3
2022-09-02clippy: BindingAnnotation changeCameron Steffen-8/+8
2022-08-31Auto merge of #101249 - matthiaskrgr:rollup-wahnoz8, r=matthiaskrgrbors-659/+4303
Rollup of 10 pull requests Successful merges: - #100787 (Pretty printing give proper error message without panic) - #100838 (Suggest moving redundant generic args of an assoc fn to its trait) - #100844 (migrate rustc_query_system to use SessionDiagnostic) - #101140 (Update Clippy) - #101161 (Fix uintended diagnostic caused by `drain(..)`) - #101165 (Use more `into_iter` rather than `drain(..)`) - #101229 (Link “? operator” to relevant chapter in The Book) - #101230 (lint: avoid linting diag functions with diag lints) - #101236 (Avoid needless buffer zeroing in `std::sys::windows::fs`) - #101240 (Fix a typo on `wasm64-unknown-unknown` doc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup