summary refs log tree commit diff
path: root/src/tools/clippy/clippy_lints
AgeCommit message (Collapse)AuthorLines
2021-03-18hir: Preserve used syntax in `TyKind::TraitObject`Vadim Petrochenkov-4/+4
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-17/+17
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-16ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`Vadim Petrochenkov-3/+3
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-14/+14
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-15Fix error after rebaseRoxane-0/+3
2021-03-15Add comments with examples and testsRoxane-2/+2
2021-03-14Add fake_read() to clippyRoxane-0/+6
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-7627/+9058
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-6/+8
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-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-05Shrink the size of Rvalue by 16 bytesOli Scherer-2/+2
2021-03-01Use diagnostic items in into_iter_collectionsCameron Steffen-2/+2
2021-02-26Add missing diagnostic item SymbolsCameron Steffen-16/+18
2021-02-25Merge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyupflip1995-7061/+1379
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-464/+719
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-464/+719
2021-02-09Rename HIR UnOp variantsÖmer Sinan Ağacan-41/+41
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-1/+1
2021-02-03Suggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call.Mara Bos-1/+1
2021-02-03Use PrimTy in builtin type shadow lintCameron Steffen-18/+4
2021-02-02Merge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippyManish Goregaokar-41/+176
2021-02-01Box the biggest ast::ItemKind variantsDániel Buga-54/+94
2021-01-30Merge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyupflip1995-207/+858
2021-01-29Rollup merge of #81176 - camsteffen:qpath-res, r=oli-obkYuki Okushi-58/+45
Improve safety of `LateContext::qpath_res` This is my first rustc code change, inspired by hacking on clippy! The first change is to clear cached `TypeckResults` from `LateContext` when visiting a nested item. I took a hint from [here](https://github.com/rust-lang/rust/blob/5e91c4ecc09312d8b63d250a432b0f3ef83f1df7/compiler/rustc_privacy/src/lib.rs#L1300). Clippy has a `qpath_res` util function to avoid a possible ICE in `LateContext::qpath_res`. But the docs of `LateContext::qpath_res` promise no ICE. So this updates the `LateContext` method to keep its promises, and removes the util function. Related: rust-lang/rust-clippy#4545 CC ````````````@eddyb```````````` since you've done related work CC ````````````@flip1995```````````` FYI