summary refs log tree commit diff
path: root/src/tools/clippy
AgeCommit message (Collapse)AuthorLines
2021-05-03Revert "Fix clippy's path to the copy intrinsics."Mark Rousskov-2/+2
This reverts commit 1a806352e41fcba5eac91784476fc6dfa6ee05b7.
2021-03-18hir: Preserve used syntax in `TyKind::TraitObject`Vadim Petrochenkov-5/+5
2021-03-17Auto merge of #82122 - bstrie:dep4real, r=dtolnaybors-1/+1
Deprecate `intrinsics::drop_in_place` and `collections::Bound`, which accidentally weren't deprecated Fixes #82080. I've taken the liberty of updating the `since` values to 1.52, since an unobservable deprecation isn't much of a deprecation (even the detailed release notes never bothered to mention these deprecations). As mentioned in the issue I'm *pretty* sure that using a type alias for `Bound` is semantically equivalent to the re-export; [the reference implies](https://doc.rust-lang.org/reference/items/type-aliases.html) that type aliases only observably differ from types when used on unit structs or tuple structs, whereas `Bound` is an enum.
2021-03-17Auto merge of #83188 - petrochenkov:field, r=lcnrbors-27/+29
ast/hir: Rename field-related structures I always forget what `ast::Field` and `ast::StructField` mean despite working with AST for long time, so this PR changes the naming to less confusing and more consistent. - `StructField` -> `FieldDef` ("field definition") - `Field` -> `ExprField` ("expression field", not "field expression") - `FieldPat` -> `PatField` ("pattern field", not "field pattern") Various visiting and other methods working with the fields are renamed correspondingly too. The second commit reduces the size of `ExprKind` by boxing fields of `ExprKind::Struct` in preparation for https://github.com/rust-lang/rust/pull/80080.
2021-03-17Rollup merge of #83092 - petrochenkov:qspan, r=estebankYuki Okushi-38/+28
More precise spans for HIR paths `Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path. This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span. This is a pre-requisite for https://github.com/rust-lang/rust/pull/82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans). r? ````@estebank````
2021-03-16Auto merge of #82536 - sexxi-goose:handle-patterns-take-2, r=nikomatsakisbors-0/+12
2229: Handle patterns within closures correctly when `capture_disjoint_fields` is enabled This PR fixes several issues related to handling patterns within closures when `capture_disjoint_fields` is enabled. 1. Matching is always considered a use of the place, even with `_` patterns 2. Compiler ICE when capturing fields in closures through `let` assignments To do so, we - Introduced new Fake Reads - Delayed use of `Place` in favor of `PlaceBuilder` - Ensured that `PlaceBuilder` can be resolved before attempting to extract `Place` in any of the pattern matching code Closes rust-lang/project-rfc-2229/issues/27 Closes rust-lang/project-rfc-2229/issues/24 r? `@nikomatsakis`
2021-03-16ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`Vadim Petrochenkov-5/+7
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-22/+22
StructField -> FieldDef ("field definition") Field -> ExprField ("expression field", not "field expression") FieldPat -> PatField ("pattern field", not "field pattern") Also rename visiting and other methods working on them.
2021-03-16Update clippy testsVadim Petrochenkov-38/+28
2021-03-15Fix error after rebaseRoxane-0/+3
2021-03-15Add comments with examples and testsRoxane-3/+3
2021-03-15Use `rustc_interface::interface::Config::parse_sess_created` in Clippyhyd-dev-12/+8
2021-03-14Add fake_read() to clippyRoxane-0/+9
2021-03-12Clippy: HACK! Fix bootstrap errorflip1995-2/+5
This will be removed in the next sync, once beta is at 1.52. Until then this hack avoids to put `cfg(bootstrap)` into Clippy.
2021-03-12Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyupflip1995-12241/+15389
2021-03-10Auto merge of #79519 - cjgillot:noattr, r=wesleywiserbors-81/+103
Store HIR attributes in a side table Same idea as #72015 but for attributes. The objective is to reduce incr-comp invalidations due to modified attributes. Notably, those due to modified doc comments. Implementation: - collect attributes during AST->HIR lowering, in `LocalDefId -> ItemLocalId -> &[Attributes]` nested tables; - access the attributes through a `hir_owner_attrs` query; - local refactorings to use this access; - remove `attrs` from HIR data structures one-by-one. Change in behaviour: - the HIR visitor traverses all attributes at once instead of parent-by-parent; - attribute arrays are sometimes duplicated: for statements and variant constructors; - as a consequence, attributes are marked as used after unused-attribute lint emission to avoid duplicate lints. ~~Current bug: the lint level is not correctly applied in `std::backtrace_rs`, triggering an unused attribute warning on `#![no_std]`. I welcome suggestions.~~
2021-03-09Deprecate items that accidentally weren't deprecatedbstrie-1/+1
Fixes #82080
2021-03-09Remove hir::Expr::attrs.Camille GILLOT-2/+3
2021-03-09Remove hir::Item::attrs.Camille GILLOT-16/+25
2021-03-09Remove hir::ImplItem::attrs.Camille GILLOT-7/+11
2021-03-09Remove hir::TraitItem::attrs.Camille GILLOT-7/+12
2021-03-09Remove hir::StructField::attrs.Camille GILLOT-1/+2
2021-03-09Remove hir::Variant::attrs.Camille GILLOT-1/+2
2021-03-09Remove hir::Arm::attrs.Camille GILLOT-3/+3
2021-03-09Remove hir::Crate::attrs.Camille GILLOT-9/+11
2021-03-09Remove hir::Local::attrs.Camille GILLOT-1/+1
2021-03-09Remove hir::StmtKind::attrs.Camille GILLOT-1/+1
2021-03-09Do not store attrs in FnKind.Camille GILLOT-20/+19
2021-03-09Simplify clippy author.Camille GILLOT-13/+13
2021-03-09Switch to changing cp_non_overlap in tformkadmin-1/+1
It was suggested to lower this in MIR instead of ssa, so do that instead.
2021-03-09Update craneliftkadmin-2/+2
2021-03-09Update match brancheskadmin-1/+8
This updates all places where match branches check on StatementKind or UseContext. This doesn't properly implement them, but adds TODOs where they are, and also adds some best guesses to what they should be in some cases.
2021-03-09Rollup merge of #82048 - mark-i-m:or-pat-type-ascription, r=petrochenkovMara Bos-1/+3
or-patterns: disallow in `let` bindings ~~Blocked on https://github.com/rust-lang/rust/pull/81869~~ Disallows top-level or-patterns before type ascription. We want to reserve this syntactic space for possible future generalized type ascription. r? ``@petrochenkov``
2021-03-08clippy: fix or-pattern in let bindingmark-1/+3
2021-03-08Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelixbors-3/+3
Test the effect of shrinking the size of Rvalue by 16 bytes r? `@ghost`
2021-03-05Make clippy set mir_opt_level using OptionSantiago Pastorino-1/+1
2021-03-05Shrink the size of Rvalue by 16 bytesOli Scherer-3/+3
2021-03-01Use diagnostic items in into_iter_collectionsCameron Steffen-24/+22
2021-02-26Add missing diagnostic item SymbolsCameron Steffen-17/+20
2021-02-25Fix Clippy build and testflip1995-3/+6
2021-02-25Merge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyupflip1995-3273/+6454
2021-02-19Move try_print_query_stack to rustc_interface.Camille GILLOT-3/+1
2021-02-19Rollup merge of #82238 - petrochenkov:nocratemod, r=Aaron1011Dylan DPC-3/+6
ast: Keep expansion status for out-of-line module items I.e. whether a module `mod foo;` is already loaded from a file or not. This is a pre-requisite to correctly treating inner attributes on such modules (https://github.com/rust-lang/rust/issues/81661). With this change AST structures for `mod` items diverge even more for AST structure for the crate root, which previously used `ast::Mod`. Therefore this PR removes `ast::Mod` from `ast::Crate` in the first commit, these two things are sufficiently different from each other, at least at syntactic level. Customization points for visiting a "`mod` item or crate root" were also removed from AST visitors (`fn visit_mod`). `ast::Mod` itself was refactored away in the second commit in favor of `ItemKind::Mod(Unsafe, ModKind)`.
2021-02-18Rollup merge of #82215 - TaKO8Ki:replace-if-let-while-let, r=varkorDylan DPC-1/+1
Replace if-let and while-let with `if let` and `while let` This pull request replaces if-let and while-let with `if let` and `while let`. closes https://github.com/rust-lang/rust/issues/82205
2021-02-18ast: Keep expansion status for out-of-line module itemsVadim Petrochenkov-3/+6
Also remove `ast::Mod` which is mostly redundant now
2021-02-17Auto merge of #81993 - flip1995:clippyup, r=Manishearthbors-610/+1802
Update Clippy Biweekly Clippy update r? `@Manishearth`
2021-02-17replace if-let and while-let with `if let` and `while let`Takayuki Maeda-1/+1
2021-02-15Only store a LocalDefId in hir::ImplItem.Camille GILLOT-47/+36
2021-02-15Only store a LocalDefId in hir::TraitItem.Camille GILLOT-19/+15
2021-02-15Only store a LocalDefId in hir::Item.Camille GILLOT-56/+41
Items are guaranteed to be HIR owner.