summary refs log tree commit diff
path: root/src/tools/clippy/clippy_lints
AgeCommit message (Collapse)AuthorLines
2022-02-22Move `return_self_not_must_use` to `pedantic`xFrednet-3/+2
2022-01-27Handle implicit named arguments in `useless_format`Jason Newcomb-2/+17
2022-01-04Rollup merge of #91907 - lcnr:const-arg-infer, r=BoxyUwUMatthias Krüger-4/+17
Allow `_` as the length of array types and repeat expressions r? `@BoxyUwU` cc `@varkor`
2021-12-31Auto merge of #92252 - GuillaumeGomez:update-pulldown, r=camelid,xFrednetbors-5/+5
Update pulldown-cmark version to 0.9 Fixes https://github.com/rust-lang/rust/issues/92206. r? `@camelid`
2021-12-30Merge commit '0eff589afc83e21a03a168497bbab6b4dfbb4ef6' into clippyupflip1995-159/+332
2021-12-28Update pulldown-cmark version in clippyGuillaume Gomez-5/+5
2021-12-23fix clippylcnr-4/+17
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-70/+72
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-17Auto merge of #89841 - cormacrelf:let-else-typed, r=nagisabors-20/+30
Implement let-else type annotations natively Tracking issue: #87335 Fixes #89688, fixes #89807, edit: fixes #89960 as well As explained in https://github.com/rust-lang/rust/issues/89688#issuecomment-940405082, the previous desugaring moved the let-else scrutinee into a dummy variable, which meant if you wanted to refer to it again in the else block, it had moved. This introduces a new hir type, ~~`hir::LetExpr`~~ `hir::Let`, which takes over all the fields of `hir::ExprKind::Let(...)` and adds an optional type annotation. The `hir::Let` is then treated like a `hir::Local` when type checking a function body, specifically: * `GatherLocalsVisitor` overrides a new `Visitor::visit_let_expr` and does pretty much exactly what it does for `visit_local`, assigning a local type to the `hir::Let` ~~(they could be deduplicated but they are right next to each other, so at least we know they're the same)~~ * It reuses the code in `check_decl_local` to typecheck the `hir::Let`, simply returning 'bool' for the expression type after doing that. * ~~`FnCtxt::check_expr_let` passes this local type in to `demand_scrutinee_type`, and then imitates check_decl_local's pattern checking~~ * ~~`demand_scrutinee_type` (the blindest change for me, please give this extra scrutiny) uses this local type instead of of creating a new one~~ * ~~Just realised the `check_expr_with_needs` was passing NoExpectation further down, need to pass the type there too. And apparently this Expectation API already exists.~~ Some other misc notes: * ~~Is the clippy code supposed to be autoformatted? I tried not to give huge diffs but maybe some rustfmt changes simply haven't hit it yet.~~ * in `rustc_ast_lowering/src/block.rs`, I noticed some existing `self.alias_attrs()` calls in `LoweringContext::lower_stmts` seem to be copying attributes from the lowered locals/etc to the statements. Is that right? I'm new at this, I don't know.
2021-12-17Merge commit '23d11428de3e973b34a5090a78d62887f821c90e' into clippyupflip1995-356/+976
2021-12-15Remove unnecessary sigils around `Ident::as_str()` calls.Nicholas Nethercote-20/+20
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-31/+31
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-19/+21
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-15Rollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcmMatthias Krüger-1/+0
Stabilize `iter::zip` Hello all! As the tracking issue (#83574) for `iter::zip` completed the final commenting period without any concerns being raised, I hereby submit this stabilization PR on the issue. As the pull request that introduced the feature (#82917) states, the `iter::zip` function is a shorter way to zip two iterators. As it's generally a quality-of-life/ergonomic improvement, it has been integrated into the codebase without any trouble, and has been used in many places across the rust compiler and standard library since March without any issues. For more details, I would refer to `@cuviper's` original PR, or the [function's documentation](https://doc.rust-lang.org/std/iter/fn.zip.html).
2021-12-14Remove iter::zip feature gate from clippyPFPoitras-1/+0
2021-12-13Fix rebase and clippy testsEsteban Kuber-3/+8
2021-12-13Fix clippy uses of QPath::LangItemEsteban Kuber-6/+6
2021-12-13let-else: use hir::Let in clippyCormac Relf-20/+30
fix clippy format using `cargo fmt -p clippy_{lints,utils}` manually revert rustfmt line truncations rename to hir::Let in clippy Undo the shadowing of various `expr` variables after renaming `scrutinee` reduce destructuring of hir::Let to avoid `expr` collisions cargo fmt -p clippy_{lints,utils} bless new clippy::author output
2021-12-12Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"Deadbeef-2/+2
This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.
2021-12-06Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyupflip1995-1554/+3523
2021-12-04Use IntoIterator for array impl everywhere.Mara Bos-2/+1
2021-12-03Add initial AST and MIR support for unwinding from inline assemblyAmanieu d'Antras-5/+3
2021-12-03Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"Santiago Pastorino-2/+2
This reverts commit 18bb8c61a975fff6424cda831ace5b0404277145, reversing changes made to d9baa361902b172be716f96619b909f340802dea.
2021-12-02Auto merge of #91354 - fee1-dead:const_env, r=spastorinobors-2/+2
Cleanup: Eliminate ConstnessAnd This is almost a behaviour-free change and purely a refactoring. "almost" because we appear to be using the wrong ParamEnv somewhere already, and this is now exposed by failing a test using the unstable `~const` feature. We most definitely need to review all `without_const` and at some point should probably get rid of many of them by using `TraitPredicate` instead of `TraitRef`. This is a continuation of https://github.com/rust-lang/rust/pull/90274. r? `@oli-obk` cc `@spastorino` `@ecstatic-morse`
2021-11-29Fix toolsDeadbeef-2/+2
2021-11-28Take a LocalDefId in expect_*item.Camille GILLOT-12/+6
2021-11-21clippy: Fix pattern_type_mismatch for loopCameron Steffen-164/+43
2021-11-21Fix Clippy with changed for loop desugarCameron Steffen-59/+56
2021-11-18rustc: Remove `#[rustc_synthetic]`Vadim Petrochenkov-5/+3
This function parameter attribute was introduced in https://github.com/rust-lang/rust/pull/44866 as an intermediate step in implementing `impl Trait`, it's not necessary or used anywhere by itself.
2021-11-09Rollup merge of #89561 - nbdd0121:const_typeck, r=nikomatsakisMatthias Krüger-1/+4
Type inference for inline consts Fixes #78132 Fixes #78174 Fixes #81857 Fixes #89964 Perform type checking/inference of inline consts in the same context as the outer def, similar to what is currently done to closure. Doing so would require `closure_base_def_id` of the inline const to return the outer def, and since `closure_base_def_id` can be called on non-local crate (and thus have no HIR available), a new `DefKind` is created for inline consts. The type of the generated anon const can capture lifetime of outer def, so we couldn't just use the typeck result as the type of the inline const's def. Closure has a similar issue, and it uses extra type params `CK, CS, U` to capture closure kind, input/output signature and upvars. I use a similar approach for inline consts, letting it have an extra type param `R`, and then `typeof(InlineConst<[paremt generics], R>)` would just be `R`. In borrowck region requirements are also propagated to the outer MIR body just like it's currently done for closure. With this PR, inline consts in expression position are quitely usable now; however the usage in pattern position is still incomplete -- since those does not remain in the MIR borrowck couldn't verify the lifetime there. I have left an ignored test as a FIXME. Some disucssions can be found on [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/inline.20consts.20typeck). cc `````@spastorino````` `````@lcnr````` r? `````@nikomatsakis````` `````@rustbot````` label A-inference F-inline_const T-compiler
2021-11-08Make select_* methods return Vec for TraitEngineDeadbeef-2/+2
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-13/+13
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-07Give inline const separate DefKindGary Guo-1/+4
2021-11-04Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyupflip1995-370/+577
2021-11-02Update clippy dependenciesxFrednet-2/+2
* semver = "0.11" -> "1.0" * cargo_metadata = "0.12" -> "0.14"
2021-10-22Rollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwcoYuki Okushi-7/+1
Don't mark for loop iter expression as desugared We typically don't mark spans of lowered things as desugared. This helps Clippy rightly discern when code is (not) from expansion. This was discovered by ``@flip1995`` at https://github.com/rust-lang/rust-clippy/pull/7789#issuecomment-939289501.
2021-10-21Merge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyupflip1995-282/+1416
2021-10-17Rollup merge of #89963 - r00ster91:parenthesisparentheses, r=nagisaMatthias Krüger-1/+1
Some "parenthesis" and "parentheses" fixes "Parenthesis" is the singular (e.g. one `(` or one `)`) and "parentheses" is the plural (multiple `(` or `)`s) and this is not hard to mix up so here are some fixes for that. Inspired by #89958
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-1/+1
2021-10-15Fix clippy with for loop span changeCameron Steffen-7/+1
2021-10-15Fix clippy with changed macro statement spansCameron Steffen-21/+17
2021-10-11Deprecate mem_discriminant_non_enumflip1995-87/+1
This lint has been uplifted and is now included in enum_intrinsics_non_enums.
2021-10-07Merge commit 'b7f3f7f6082679da2da9a0b3faf1b5adef3afd3b' into clippyupflip1995-1882/+2155
2021-10-02Make diangostic item names consistentCameron Steffen-177/+180
2021-09-30Do not pass hir::Crate to lints.Camille GILLOT-25/+26
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-5/+3
2021-09-28Merge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyupflip1995-401/+786
2021-09-25Rollup merge of #89216 - r00ster91:bigo, r=dtolnayManish Goregaokar-1/+1
Consistent big O notation This makes the big O time complexity notation in places with markdown support more consistent. Inspired by #89210
2021-09-24Rollup merge of #89001 - jackh726:binder-cleanup, r=nikomatsakisJubilee-3/+3
Be explicit about using Binder::dummy This is somewhat of a late followup to the binder refactor PR. It removes `ToPredicate` and `ToPolyTraitImpls` that hide the use of `Binder::dummy`. While this does make code a bit more verbose, it allows us be more careful about where we create binders. Another alternative here might be to add a new trait `ToBinder` or something with a `dummy()` fn. Which could still allow grepping but allows doing something like `trait_ref.dummy()` (but I also wonder if longer-term, it would be better to be even more explicit with a `bind_with_vars(ty::List::empty())` *but* that's not clear yet. r? ``@nikomatsakis``
2021-09-24consistent big O notationr00ster91-1/+1