about summary refs log tree commit diff
path: root/src/tools/clippy
AgeCommit message (Collapse)AuthorLines
2022-01-29Change index_refutable_slice to use FxIndexMapGary Guo-6/+6
This will prevent unstable order when HirIds are pertubated.
2022-01-29Create `core::fmt::ArgumentV1` with generics instead of fn pointerGary Guo-6/+16
2022-01-27Merge commit 'a98e7ab8b94485be6bd03e0c6b8682ecab5b52e6' into clippyupflip1995-997/+1841
2022-01-25Auto merge of #93095 - Aaron1011:remove-assoc-ident, r=cjgillotbors-1/+1
Store a `Symbol` instead of an `Ident` in `AssocItem` This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-23Update clippyVadim Petrochenkov-64/+54
2022-01-23rustc_lint: Reuse the set of registered tools from resolverVadim Petrochenkov-1/+1
2022-01-21Remove a span from hir::ExprKind::MethodCallCameron Steffen-168/+162
2022-01-21Auto merge of #91359 - dtolnay:args, r=Mark-Simulacrumbors-1/+10
Emit simpler code from format_args I made this PR so that `cargo expand` dumps a less overwhelming amount of formatting-related code. <br> `println!("rust")` **Before:** ```rust { ::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"], &match () { _args => [], })); }; ``` **After:** ```rust { ::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"], &[])); }; ``` `println!("{}", x)` **Before:** ```rust { ::std::io::_print(::core::fmt::Arguments::new_v1( &["", "\n"], &match (&x,) { _args => [::core::fmt::ArgumentV1::new( _args.0, ::core::fmt::Display::fmt, )], }, )); }; ``` **After:** ```rust { ::std::io::_print(::core::fmt::Arguments::new_v1( &["", "\n"], &[::core::fmt::ArgumentV1::new(&x, ::core::fmt::Display::fmt)], )); }; ```
2022-01-19Store a `Symbol` instead of an `Ident` in `AssocItem`Aaron Hill-1/+1
This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-18Auto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obkbors-11/+25
allow eq constraints on associated constants Updates #70256 (cc `@varkor,` `@Centril)`
2022-01-18Auto merge of #93001 - flip1995:clippyup, r=Manishearthbors-100/+754
Out of cycle Clippy update I want to do an out-of-cycle sync for rust-lang/rust-clippy#8295, and possibly backport this to stable together with https://github.com/rust-lang/rust/issues/92938. If this doesn't get backported to stable, then I at least want to backport it to beta. r? `@Manishearth`
2022-01-17Update w/ commentskadmin-1/+1
Removes uses of ty() where a method is implemented on TypeFoldable, and also directly formats a Term.
2022-01-17Update term for use in more placeskadmin-6/+12
Replace use of `ty()` on term and use it in more places. This will allow more flexibility in the future, but slightly worried it allows items which are consts which only accept types.
2022-01-17Bless clippy ui tests after format_args changeDavid Tolnay-1/+10
2022-01-17Use Term in ProjectionPredicatekadmin-7/+7
ProjectionPredicate should be able to handle both associated types and consts so this adds the first step of that. It mainly just pipes types all the way down, not entirely sure how to handle consts, but hopefully that'll come with time.
2022-01-17Add termkadmin-2/+9
Instead of having a separate enum variant for types and consts have one but have either a const or type.
2022-01-17add eq constraints on associated constantskadmin-2/+3
2022-01-17Auto merge of #90986 - camsteffen:nested-filter, r=cjgillotbors-435/+130
Replace `NestedVisitorMap` with generic `NestedFilter` This is an attempt to make the `intravisit::Visitor` API simpler and "more const" with regard to nested visiting. With this change, `intravisit::Visitor` does not visit nested things by default, unless you specify `type NestedFilter = nested_filter::OnlyBodies` (or `All`). `nested_visit_map` returns `Self::Map` instead of `NestedVisitorMap<Self::Map>`. It panics by default (unreachable if `type NestedFilter` is omitted). One somewhat trixty thing here is that `nested_filter::{OnlyBodies, All}` live in `rustc_middle` so that they may have `type Map = map::Map` and so that `impl Visitor`s never need to specify `type Map` - it has a default of `Self::NestedFilter::Map`.
2022-01-17Merge commit '8d14c94b5c0a66241b4244f1c60ac5859cec1d97' into clippyupflip1995-100/+754
2022-01-17Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieubors-29/+3
Remove deprecated LLVM-style inline assembly The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it is time to remove `llvm_asm!` to avoid continued maintenance cost. Closes #70173. Closes #92794. Closes #87612. Closes #82065. cc `@rust-lang/wg-inline-asm` r? `@Amanieu`
2022-01-16Fix Visitor::NestedFilter in ClippyCameron Steffen-419/+126
2022-01-16Format clippyCameron Steffen-16/+4
2022-01-16Auto merge of #92805 - BoxyUwU:revert-lazy-anon-const-substs, r=lcnrbors-39/+41
partially revertish `lazily "compute" anon const default substs` reverts #87280 except for some of the changes around `ty::Unevaluated` having a visitor and a generic for promoted why revert: <https://github.com/rust-lang/rust/pull/92805#issuecomment-1010736049> r? `@lcnr`
2022-01-16Auto merge of #92740 - cuviper:update-rayons, r=Mark-Simulacrumbors-1/+1
Update rayon and rustc-rayon This updates rayon for various tools and rustc-rayon for the compiler's parallel mode. - rayon v1.3.1 -> v1.5.1 - rayon-core v1.7.1 -> v1.9.1 - rustc-rayon v0.3.1 -> v0.3.2 - rustc-rayon-core v0.3.1 -> v0.3.2 ... and indirectly, this updates all of crossbeam-* to their latest versions. Fixes #92677 by removing crossbeam-queue, but there's still a lingering question about how tidy discovers "runtime" dependencies. None of this is truly in the standard library's dependency tree at all.
2022-01-15Return a LocalDefId in get_parent_item.Camille GILLOT-39/+39
2022-01-15nyahggdshjjghsdfhgsfEllen-9/+7
2022-01-15initial revertEllen-40/+44
2022-01-14Rollup merge of #92849 - flip1995:clippyup, r=ManishearthMatthias Krüger-1682/+3256
Clippyup r? ```@Manishearth```
2022-01-13Auto merge of #89861 - nbdd0121:closure, r=wesleywiserbors-2/+2
Closure capture cleanup & refactor Follow up of #89648 Each commit is self-contained and the rationale/changes are documented in the commit message, so it's advisable to review commit by commit. The code is significantly cleaner (at least IMO), but that could have some perf implication, so I'd suggest a perf run. r? `@wesleywiser` cc `@arora-aman`
2022-01-13Fix Clippy sync falloutflip1995-3/+3
2022-01-13Merge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyupflip1995-1682/+3256
2022-01-12Remove LLVM-style inline assembly from clippyTomasz Miąsko-29/+3
2022-01-11Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`Aaron Hill-4/+4
The field is also renamed from `ident` to `name. In most cases, we don't actually need the `Span`. A new `ident` method is added to `VariantDef` and `FieldDef`, which constructs the full `Ident` using `tcx.def_ident_span()`. This method is used in the cases where we actually need an `Ident`. This makes incremental compilation properly track changes to the `Span`, without all of the invalidations caused by storing a `Span` directly via an `Ident`.
2022-01-10Update rayon and rustc-rayonJosh Stone-1/+1
2022-01-09rustc_metadata: Rename `item_children(_untracked)` to ↵Vadim Petrochenkov-6/+6
`module_children(_untracked)` And `each_child_of_item` to `for_each_module_child`
2022-01-09rustc_metadata: Optimize and document module children decodingVadim Petrochenkov-12/+19
2022-01-07Remove region from UpvarCapture and move it to CapturedPlaceGary Guo-1/+1
Region info is completely unnecessary for upvar capture kind computation and is only needed to create the final upvar tuple ty. Doing so makes creation of UpvarCapture very cheap and expose further cleanup opportunity.
2022-01-07Remove span from UpvarCapture::ByValueGary Guo-1/+1
This span is unused and is superseded by capture_kind_expr_id in CaptureInfo
2022-01-07Update clippy for associated item changesMatthew Jasper-14/+16
2022-01-04Rollup merge of #91907 - lcnr:const-arg-infer, r=BoxyUwUMatthias Krüger-20/+50
Allow `_` as the length of array types and repeat expressions r? `@BoxyUwU` cc `@varkor`
2022-01-03Rollup merge of #90102 - nbdd0121:box3, r=jonas-schievinkMatthias Krüger-1/+0
Remove `NullOp::Box` Follow up of #89030 and MCP rust-lang/compiler-team#460. ~1 month later nothing seems to be broken, apart from a small regression that #89332 (1aac85bb716c09304b313d69d30d74fe7e8e1a8e) shows could be regained by remvoing the diverging path, so it shall be safe to continue and remove `NullOp::Box` completely. r? `@jonas-schievink` `@rustbot` label T-compiler
2021-12-31Make tidy check for magic numbers that spell thingsJosh Triplett-7/+7
Remove existing problematic cases.
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-439/+1493
2021-12-28Update pulldown-cmark version in clippyGuillaume Gomez-5/+5
2021-12-23fix clippylcnr-20/+50
2021-12-22Bless clippy test.Mara Bos-1/+1
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-75/+77
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-31/+56
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-4446/+2856