about summary refs log tree commit diff
path: root/src/tools/clippy/clippy_lints
AgeCommit message (Collapse)AuthorLines
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
2021-01-28Rollup merge of #81277 - flip1995:from_diag_items, r=matthewjasperYuki Okushi-6/+2
Make more traits of the From/Into family diagnostic items Following traits are now diagnostic items: - `From` (unchanged) - `Into` - `TryFrom` - `TryInto` This also adds symbols for those items: - `into_trait` - `try_from_trait` - `try_into_trait` Related: https://github.com/rust-lang/rust-clippy/pull/6620#discussion_r562482587
2021-01-28Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakisYuki Okushi-30/+24
Refractor a few more types to `rustc_type_ir` In the continuation of #79169, ~~blocked on that PR~~. This PR: - moves `IntVarValue`, `FloatVarValue`, `InferTy` (and friends) and `Variance` - creates the `IntTy`, `UintTy` and `FloatTy` enums in `rustc_type_ir`, based on their `ast` and `chalk_ir` equilavents, and uses them for types in the rest of the compiler. ~~I will split up that commit to make this easier to review and to have a better commit history.~~ EDIT: done, I split the PR in commits of 200-ish lines each r? `````@nikomatsakis````` cc `````@jackh726`````
2021-01-22Make more traits of the From/Into family diagnostic itemsflip1995-6/+2
Following traits are now diagnostic items: - `From` (unchanged) - `Into` - `TryFrom` - `TryInto` This also adds symbols for those items: - `into_trait` - `try_from_trait` - `try_into_trait`
2021-01-21Fix clippy and commentEsteban Küber-6/+6
2021-01-21Add loop head span to hirEsteban Küber-6/+6
2021-01-20Force token collection to run when parsing nonterminalsAaron Hill-1/+2
Fixes #81007 Previously, we would fail to collect tokens in the proper place when only builtin attributes were present. As a result, we would end up with attribute tokens in the collected `TokenStream`, leading to duplication when we attempted to prepend the attributes from the AST node. We now explicitly track when token collection must be performed due to nomterminal parsing.
2021-01-18Remove qpath_res util functionCameron Steffen-58/+45
2021-01-18Use ty::{IntTy,UintTy,FloatTy} in rustdoc and clippyLeSeulArtichaut-30/+24
2021-01-18Rollup merge of #81038 - flip1995:clippyup, r=ManishearthAshley Mannix-134/+914
Update Clippy Biweekly Clippy update r? ``@Manishearth``
2021-01-17Auto merge of #80679 - jackh726:predicate-kind-take2, r=lcnrbors-26/+24
Remove PredicateKind and instead only use Binder<PredicateAtom> Originally brought up in https://github.com/rust-lang/rust/pull/76814#discussion_r546858171 r? `@lcnr`
2021-01-16Review changesJack Huey-25/+22
2021-01-16CleanupJack Huey-2/+1
2021-01-16Use pred not binderJack Huey-1/+1
2021-01-16CleanupJack Huey-1/+1
2021-01-16Remove PredicateKindJack Huey-1/+1
2021-01-16Remove PredicateKind::AtomJack Huey-6/+8
2021-01-16Deprecate unknown_clippy_lintsflip1995-73/+19
This is now handled by unknown_lints
2021-01-15Merge commit '953f024793dab92745fee9cd2c4dee6a60451771' into clippyupflip1995-134/+914
2021-01-14Auto merge of #79328 - c410-f3r:hir-if, r=matthewjasperbors-129/+150
Reintroduce hir::ExprKind::If Basically copied and paste #59288/https://github.com/rust-lang/rust-clippy/pull/4080 with some modifications. The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome. - [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051) - [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d) - [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5) - [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691) - [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95) - [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)
2021-01-13Auto merge of #77524 - Patryk27:fixes/66228, r=estebankbors-1/+1
Rework diagnostics for wrong number of generic args (fixes #66228 and #71924) This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
2021-01-12Separate out a `hir::Impl` structJoshua Nelson-69/+61
This makes it possible to pass the `Impl` directly to functions, instead of having to pass each of the many fields one at a time. It also simplifies matches in many cases.
2021-01-10Rework diagnostics for wrong number of generic argsPatryk Wychowaniec-1/+1
2021-01-09ast: Remove some indirection layers from values in key-value attributesVadim Petrochenkov-1/+1
2021-01-07Reintroduce hir::ExprKind::IfCaio-129/+150
2021-01-02Merge commit '1fcc74cc9e03bc91eaa80ecf92976b0b14b3aeb6' into clippyupflip1995-144/+228
2021-01-01first pass at default values for const genericsJulian Knodt-1/+6
- Adds optional default values to const generic parameters in the AST and HIR - Parses these optional default values - Adds a `const_generics_defaults` feature gate
2020-12-30Rename kw::Invalid -> kw::EmptyJoshua Nelson-1/+1
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context.
2020-12-20Merge commit '4911ab124c481430672a3833b37075e6435ec34d' into clippyupflip1995-301/+938
2020-12-19More rebindsJack Huey-1/+1
2020-12-17Auto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakisbors-2/+2
Move binder for dyn to each list item This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`. This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.` r? `@nikomatsakis`
2020-12-17Rollup merge of #79051 - LeSeulArtichaut:if-let-guard, r=matthewjasperYuki Okushi-1/+25
Implement if-let match guards Implements rust-lang/rfcs#2294 (tracking issue: #51114). I probably should do a few more things before this can be merged: - [x] Add tests (added basic tests, more advanced tests could be done in the future?) - [x] Add lint for exhaustive if-let guard (comparable to normal if-let statements) - [x] Fix clippy However since this is a nightly feature maybe it's fine to land this and do those steps in follow-up PRs. Thanks a lot `@matthewjasper` :heart: for helping me with lowering to MIR! Would you be interested in reviewing this? r? `@ghost` for now
2020-12-11Move binder for dyn to each list itemJack Huey-2/+2
2020-12-06Retain assembly operands span when lowering AST to HIRTomasz Miąsko-3/+3
2020-12-06Merge commit 'c1664c50b27a51f7a78c93ba65558e7c33eabee6' into clippyupflip1995-368/+1815
2020-12-06Handle `Guard::IfLet` in clippyLeSeulArtichaut-1/+24
2020-12-06Implement lowering of if-let guards to MIRLeSeulArtichaut-0/+1
2020-11-26Remove ForeignMod struct.Camille GILLOT-3/+3
2020-11-24Move lev_distance to rustc_ast, make non-genericArlie Davis-2/+2
rustc_ast currently has a few dependencies on rustc_lexer. Ideally, an AST would not have any dependency its lexer, for minimizing unnecessarily design-time dependencies. Breaking this dependency would also have practical benefits, since modifying rustc_lexer would not trigger a rebuild of rustc_ast. This commit does not remove the rustc_ast --> rustc_lexer dependency, but it does remove one of the sources of this dependency, which is the code that handles fuzzy matching between symbol names for making suggestions in diagnostics. Since that code depends only on Symbol, it is easy to move it to rustc_span. It might even be best to move it to a separate crate, since other tools such as Cargo use the same algorithm, and have simply contain a duplicate of the code. This changes the signature of find_best_match_for_name so that it is no longer generic over its input. I checked the optimized binaries, and this function was duplicated at nearly every call site, because most call sites used short-lived iterator chains, generic over Map and such. But there's no good reason for a function like this to be generic, since all it does is immediately convert the generic input (the Iterator impl) to a concrete Vec<Symbol>. This has all of the costs of generics (duplicated method bodies) with no benefit. Changing find_best_match_for_name to be non-generic removed about 10KB of code from the optimized binary. I know it's a drop in the bucket, but we have to start reducing binary size, and beginning to tame over-use of generics is part of that.
2020-11-24Auto merge of #79228 - flip1995:clippyup, r=oli-obkbors-324/+833
Update Clippy Biweekly Clippy update r? `@Manishearth`
2020-11-23Auto merge of #78439 - lzutao:rm-clouldabi, r=Mark-Simulacrumbors-1/+1
Drop support for all cloudabi targets `cloudabi` is a tier-3 target, and [it is no longer being maintained upstream][no]. This PR drops supports for cloudabi targets. Those targets are: * aarch64-unknown-cloudabi * armv7-unknown-cloudabi * i686-unknown-cloudabi * x86_64-unknown-cloudabi Since this drops supports for a target, I'd like somebody to tag `relnotes` label to this PR. Some other issues: * The tidy exception for `cloudabi` crate is still remained because * `parking_lot v0.9.0` and `parking_lot v0.10.2` depends on `cloudabi v0.0.3`. * `parking_lot v0.11.0` depends on `cloudabi v0.1.0`. [no]: https://github.com/NuxiNL/cloudabi#note-this-project-is-unmaintained
2020-11-23Fix ICE in utils::implements_traitflip1995-0/+3
This only happend when debug_assertions were enabled in rustc
2020-11-23Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyupflip1995-324/+830
2020-11-22Drop support for cloudabi targetsLzu Tao-1/+1