about summary refs log tree commit diff
path: root/src/tools/clippy/clippy_utils
AgeCommit message (Collapse)AuthorLines
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-29Use `&'hir Ty` everywhere.Nicholas Nethercote-1/+1
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-29Use `&'hir Expr` everywhere.Nicholas Nethercote-1/+1
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-1/+1
2022-08-23Remove the symbol from `ast::LitKind::Err`.Nicholas Nethercote-5/+3
Because it's never used meaningfully.
2022-08-16Shrink `ast::Attribute`.Nicholas Nethercote-7/+7
2022-08-12Adjust cfgsMark Rousskov-1/+0
2022-08-12Auto merge of #100419 - flip1995:clippyup, r=Manishearthbors-44/+379
Update Clippy r? `@Manishearth`
2022-08-11Merge commit '2b2190cb5667cdd276a24ef8b9f3692209c54a89' into clippyupPhilipp Krones-44/+379
2022-08-10Do not consider method call receiver as an argument in AST.Camille GILLOT-1/+3
2022-08-01Auto merge of #99884 - nnethercote:lexer-improvements, r=matkladbors-2/+2
Lexer improvements Some cleanups and small speed improvements. r? `@matklad`
2022-08-01Shrink `Token`.Nicholas Nethercote-2/+2
From 72 bytes to 12 bytes (on x86-64). There are two parts to this: - Changing various source code offsets from 64-bit to 32-bit. This is not a problem because the rest of rustc also uses 32-bit source code offsets. This means `Token` is no longer `Copy` but this causes no problems. - Removing the `RawStrError` from `LiteralKind`. Raw string literal invalidity is now indicated by a `None` value within `RawStr`/`RawByteStr`, and the new `validate_raw_str` function can be used to re-lex an invalid raw string literal to get the `RawStrError`. There is one very small change in behaviour. Previously, if a raw string literal matched both the `InvalidStarter` and `TooManyHashes` cases, the latter would override the former. This has now changed, because `raw_double_quoted_string` now uses `?` and so returns immediately upon detecting the `InvalidStarter` case. I think this is a slight improvement to report the earlier-detected error, and it explains the change in the `test_too_many_hashes` test. The commit also removes a couple of comments that refer to #77629 and say that the size of these types don't affect performance. These comments are wrong, though the performance effect is small.
2022-07-31Rollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillotDylan DPC-1/+1
Use LocalDefId for closures more
2022-07-30Use LocalDefId for closures moreCameron Steffen-1/+1
2022-07-29Change enclosing_body_owner to return LocalDefIdMiguel Guarniz-1/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-28Merge commit '3c7e7dbc1583a0b06df5bd7623dd354a4debd23d' into clippyupPhilipp Krones-44/+12
2022-07-20Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"Oli Scherer-1/+0
This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.
2022-07-18Merge commit 'fdb84cbfd25908df5683f8f62388f663d9260e39' into clippyupPhilipp Krones-39/+253
2022-07-16Stabilize `let_chains`Caio-1/+1
2022-07-15Introduce opaque type to hidden type projectionOli Scherer-0/+1
2022-07-14Auto merge of #95956 - yaahc:stable-in-unstable, r=cjgillotbors-1/+1
Support unstable moves via stable in unstable items part of https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/moving.20items.20to.20core.20unstably and a blocker of https://github.com/rust-lang/rust/pull/90328. The libs-api team needs the ability to move an already stable item to a new location unstably, in this case for Error in core. Otherwise these changes are insta-stable making them much harder to merge. This PR attempts to solve the problem by checking the stability of path segments as well as the last item in the path itself, which is currently the only thing checked.
2022-07-14Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillotDylan DPC-13/+22
Implement `for<>` lifetime binder for closures This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following: ```rust let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) }; // ^^^^^^^^^^^--- new! ``` cc ``@Aaron1011`` ``@cjgillot``
2022-07-13Auto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPCbors-2/+6
Rollup of 5 pull requests Successful merges: - #98574 (Lower let-else in MIR) - #99011 (`UnsafeCell` blocks niches inside its nested type from being available outside) - #99030 (diagnostics: error messages when struct literals fail to parse) - #99155 (Keep unstable target features for asm feature checking) - #99199 (Refactor: remove an unnecessary `span_to_snippet`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-12Fix clippy buildMaybe Waffle-13/+22
2022-07-12add new rval, pull deref earlyouz-a-0/+1
2022-07-11move else block into the `Local` structDing Xiang Fei-5/+5
2022-07-11lower let-else in MIR insteadDing Xiang Fei-3/+7
2022-07-08add opt in attribute for stable-in-unstable itemsJane Lusby-1/+1
2022-07-07Auto merge of #98827 - aDotInTheVoid:suggest-extern-block, r=nagisabors-2/+2
Suggest using block for `extern "abi" fn` with no body `@rustbot` modify labels: +A-diagnostics
2022-07-06Update TypeVisitor pathsAlan Egerton-1/+1
2022-07-05Relax constrained generics to TypeVisitableAlan Egerton-2/+2
2022-07-02ast: Add span to `Extern`Nixon Enraght-Moony-2/+2
2022-07-01Factor out hir::Node::BindingCameron Steffen-1/+1
2022-06-30Merge commit '0cb0f7636851f9fcc57085cf80197a2ef6db098f' into clippyupPhilipp Krones-88/+446
2022-06-19remove `span_lint_and_sugg_for_edges` from clippy utilsMaybe Waffle-90/+1
2022-06-19Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-seMatthias Krüger-2/+2
once cell renamings This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128 - Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}` - Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}` (I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc) ```@rustbot``` label +T-libs-api -T-libs
2022-06-17remove the rest of unnecessary `to_string`Takayuki Maeda-1/+1
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-2/+2
2022-06-16Merge commit 'd7b5cbf065b88830ca519adcb73fad4c0d24b1c7' into clippyupflip1995-6/+20
2022-06-15Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011Yuki Okushi-13/+15
Make `ExprKind::Closure` a struct variant. Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`. r? ``@Aaron1011``
2022-06-14fix wrong evaluation in clippyb-naber-2/+2
2022-06-14address reviewb-naber-15/+5
2022-06-14fix clippy test failuresb-naber-51/+74
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-64/+52
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-1/+1
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-1/+1
2022-06-12Make `ExprKind::Closure` a struct variant.Camille GILLOT-13/+15
2022-06-04Merge commit 'd9ddce8a223cb9916389c039777b6966ea448dc8' into clippyupPhilipp Krones-27/+71
2022-06-03Rollup merge of #97415 - cjgillot:is-late-bound-solo, r=estebankDylan DPC-5/+3
Compute `is_late_bound_map` query separately from lifetime resolution This query is actually very simple, and is only useful for functions and method. It can be computed directly by fetching the HIR, with no need to embed it within the lifetime resolution visitor. Based on https://github.com/rust-lang/rust/pull/96296
2022-06-03Manipulate lifetimes by LocalDefId for region resolution.Camille GILLOT-5/+3