about summary refs log tree commit diff
path: root/src/tools/clippy
AgeCommit message (Collapse)AuthorLines
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.
2021-02-15Use ItemId as a strongly typed index.Camille GILLOT-5/+5
2021-02-13Auto merge of #81238 - RalfJung:copy-intrinsics, r=m-ou-sebors-2/+2
directly expose copy and copy_nonoverlapping intrinsics This effectively un-does https://github.com/rust-lang/rust/pull/57997. That should help with `ptr::read` codegen in debug builds (and any other of these low-level functions that bottoms out at `copy`/`copy_nonoverlapping`), where the wrapper function will not get inlined. See the discussion in https://github.com/rust-lang/rust/pull/80290 and https://github.com/rust-lang/rust/issues/81163. Cc `@bjorn3` `@therealprof`
2021-02-13Fix clippy's path to the copy intrinsics.Mara Bos-2/+2
2021-02-11Merge commit '70c0f90453701e7d6d9b99aaa1fc6a765937b736' into clippyupflip1995-610/+1802
2021-02-09Rename HIR UnOp variantsÖmer Sinan Ağacan-43/+43
This renames the variants in HIR UnOp from enum UnOp { UnDeref, UnNot, UnNeg, } to enum UnOp { Deref, Not, Neg, } Motivations: - This is more consistent with the rest of the code base where most enum variants don't have a prefix. - These variants are never used without the `UnOp` prefix so the extra `Un` prefix doesn't help with readability. E.g. we don't have any `UnDeref`s in the code, we only have `UnOp::UnDeref`. - MIR `UnOp` type variants don't have a prefix so this is more consistent with MIR types. - "un" prefix reads like "inverse" or "reverse", so as a beginner in rustc code base when I see "UnDeref" what comes to my mind is something like "&*" instead of just "*".
2021-02-06Rollup merge of #81680 - camsteffen:primty, r=oli-obkJonas Schievink-18/+4
Refactor `PrimitiveTypeTable` for Clippy I removed `PrimitiveTypeTable` and added `PrimTy::ALL` and `PrimTy::from_name` in its place. This allows Clippy to use `PrimTy::from_name` for the `builtin_type_shadow` lint, and a `const` list of primitive types is deleted from Clippy code (the goal). All changes should be a little faster, if anything.
2021-02-05Bump clippy versionMark Rousskov-2/+2
2021-02-03Suggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call.Mara Bos-11/+11