about summary refs log tree commit diff
path: root/src/tools/clippy
AgeCommit message (Collapse)AuthorLines
2022-10-07Introduce TypeErrCtxtCameron Steffen-2/+2
TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't need to.
2022-10-06Merge commit '8f1ebdd18bdecc621f16baaf779898cc08cc2766' into clippyupPhilipp Krones-69/+20
2022-10-06Remove `mir::CastKind::Misc`ouz-a-1/+6
2022-10-06Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyupPhilipp Krones-4346/+10205
2022-10-04It's not about types or consts, but the lack of regionsOli Scherer-1/+1
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-267/+260
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01bless clippyMaybe Waffle-231/+231
2022-10-01clippy: adopt to the new lint APIMaybe Waffle-36/+29
2022-09-29Shrink `hir::def::Res`.Nicholas Nethercote-4/+9
`Res::SelfTy` currently has two `Option`s. When the second one is `Some` the first one is never consulted. So we can split it into two variants, `Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res` from 24 bytes to 12. This then shrinks `hir::Path` and `hir::PathSegment`, which are the HIR types that take up the most space.
2022-09-27rustc_typeck to rustc_hir_analysislcnr-31/+31
2022-09-26remove cfg(bootstrap)Pietro Albini-3/+0
2022-09-26Rollup merge of #102197 - Nilstrieb:const-new-🌲, r=Mark-Simulacrumfee1-dead-4/+15
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-24separate definitions and `HIR` ownersTakayuki Maeda-85/+85
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-24Auto merge of #102068 - cjgillot:erased-lifetime-print, r=eholkbors-11/+11
Always print '_, even for erased lifetimes. Explicit lifetime arguments are now the recommended syntax in rust 2018 and rust 2021. This PR applies this discipline to rustc itself.
2022-09-23Fix clippy's const fn stability check for CURRENT_RUSTC_VERSIONNilstrieb-1/+12
Since clippy can use a projects MSRV for its lints, it might not want to consider functions as const stable if they have been added lately. Functions that have been stabilized this version use CURRENT_RUSTC_VERSION as their version, which gets then turned into the current version, which might be something like `1.66.0-dev`. The version parser cannot deal with this version, so it has to be stripped off.
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-23Auto merge of #102056 - b-naber:unevaluated, r=lcnrbors-2/+2
Introduce mir::Unevaluated Previously the distinction between unevaluated constants in the type-system and in mir was not explicit and a little confusing. Probably better to introduce its own type for that. r? `@lcnr`
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-2/+2
2022-09-22Rollup merge of #102123 - schteve:clippy-note, r=ManishearthMatthias Krüger-0/+4
Add note to clippy::non_expressive_names doc Addresses confusion in rust-lang/rust-clippy#9514 by updating the lint docs.
2022-09-22introduce mir::Unevaluatedb-naber-2/+2
2022-09-21Add note to clippy::non_expressive_names docSteve Heindel-0/+4
2022-09-21Merge commit '7248d06384c6a90de58c04c1f46be88821278d8b' into sync-from-clippyDavid Koloski-1631/+1997
2022-09-20Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebankbors-0/+1
Allow patterns to constrain the hidden type of opaque types fixes #96572 reverts a revert as original PR was a perf regression that was fixed by reverting it: https://github.com/rust-lang/rust/pull/99368#issuecomment-1186587864) TODO: * check if https://github.com/rust-lang/rust/issues/99685 is avoided
2022-09-19remove the `Subst` trait, always use `EarlyBinder`lcnr-8/+4
2022-09-16Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, ↵Oli Scherer-0/+1
r=estebank"" This reverts commit 4a742a691e7dd2522bad68b86fe2fd5a199d5561.
2022-09-15Fix clippyest31-48/+45
2022-09-15Auto merge of #101811 - flip1995:clippyup, r=flip1995bors-3/+2
Clippy pre beta branch fix Before beta is branched on Friday, I want to move the `unused_peekable` lint that was added in this release cycle (1.65) to `nursery`. This lint was already reported twice (https://github.com/rust-lang/rust-clippy/issues/9456, https://github.com/rust-lang/rust-clippy/issues/9462) in a short time, so it is probably a good idea to fix it before it hits beta and then stable. r? `@Manishearth`
2022-09-14Temporarily move clippy::unused_peekable to nurseryPhilipp Krones-3/+2
2022-09-14Auto merge of #101212 - eholk:dyn-star, r=compiler-errorsbors-6/+9
Initial implementation of dyn* This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things: * Introduce `dyn_star` feature flag * Adds parsing for `dyn* Trait` types * Defines `dyn* Trait` as a sized type * Adds support for explicit casts, like `42usize as dyn* Debug` * Including const evaluation of such casts * Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope * Adds codegen for method calls, at least for methods that take `&self` Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits. Joint work with `@nikomatsakis` and `@compiler-errors.` r? `@bjorn3`
2022-09-14Auto merge of #101709 - nnethercote:simplify-visitors-more, r=cjgillotbors-11/+11
Simplify visitors more A successor to #100392. r? `@cjgillot`
2022-09-13Address code review commentsEric Holk-197/+127
2022-09-13Auto merge of #100640 - reitermarkus:socket-display-buffer, r=thomccbors-28/+60
Use `DisplayBuffer` for socket addresses. Continuation of https://github.com/rust-lang/rust/pull/100625 for socket addresses. Renames `net::addr` to `net::addr::socket`, `net::ip` to `net::addr::ip` and `net::ip::display_buffer::IpDisplayBuffer` to `net::addr::display_buffer::DisplayBuffer`.
2022-09-12Make x.py check workEric Holk-131/+204
2022-09-12Simplify `clippy` fix.Markus Reiter-39/+22
2022-09-12Fix clippy.Markus Reiter-16/+65
2022-09-12Auto merge of #99334 - NiklasJonsson:84447/error-privacy, r=oli-obkbors-4/+3
rustc_error, rustc_private: Switch to stable hash containers Relates https://github.com/rust-lang/rust/issues/84447
2022-09-12Remove unused argument from `visit_poly_trait_ref`.Nicholas Nethercote-6/+6
2022-09-12Remove unused span argument from `visit_name`.Nicholas Nethercote-1/+1
2022-09-12Remove unused span argument from `walk_fn`.Nicholas Nethercote-4/+4
2022-09-10Auto merge of #98559 - jackh726:remove-reempty, r=oli-obkbors-1/+1
Remove ReEmpty r? rust-lang/types
2022-09-10rustc_error, rustc_private, rustc_ast: Switch to stable hash containersNiklas Jonsson-4/+3
2022-09-09Merge commit 'b52fb5234cd7c11ecfae51897a6f7fa52e8777fc' into clippyupPhilipp Krones-686/+15491
2022-09-09Appease clippy againMichael Goulet-10/+6
2022-09-09Make clippy happyMichael Goulet-2/+7
2022-09-08Remove ReEmptyJack Huey-1/+1
2022-09-08Auto merge of #101577 - Dylan-DPC:rollup-l9xw7i7, r=Dylan-DPCbors-209/+211
Rollup of 7 pull requests Successful merges: - #98933 (Opaque types' generic params do not imply anything about their hidden type's lifetimes) - #101041 (translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Pt. 2) - #101424 (Adjust and slightly generalize operator error suggestion) - #101496 (Allow lower_lifetime_binder receive a closure) - #101501 (Allow lint passes to be bound by `TyCtxt`) - #101515 (Recover from typo where == is used in place of =) - #101545 (Remove unnecessary `PartialOrd` and `Ord`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-08Rollup merge of #101501 - Jarcho:tcx_lint_passes, r=davidtwcoDylan DPC-209/+211
Allow lint passes to be bound by `TyCtxt` This will allow storing things like `Ty<'tcx>` inside late lint passes. It's already possible to store various id types so they're already implicitly bound to a specific `TyCtxt`. r? rust-lang/compiler
2022-09-08Auto merge of #101467 - nnethercote:shrink-hir-Ty-Pat, r=spastorinobors-8/+16
Shrink `hir::Ty` and `hir::Pat` r? `@ghost`
2022-09-08Rollup merge of #101498 - petrochenkov:visparam, r=cjgillotDylan DPC-3/+3
rustc: Parameterize `ty::Visibility` over used ID It allows using `LocalDefId` instead of `DefId` when possible, and also encode cheaper `Visibility<DefIndex>` into metadata.