about summary refs log tree commit diff
path: root/src/tools/clippy
AgeCommit message (Collapse)AuthorLines
2021-10-19Remove begin_panic_fmt from clippyGary Guo-3/+0
2021-10-18Rollup merge of #89990 - petrochenkov:idempty, r=wesleywiserMatthias Krüger-9/+8
rustc_span: `Ident::invalid` -> `Ident::empty` The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s as well.
2021-10-17rustc_span: `Ident::invalid` -> `Ident::empty`Vadim Petrochenkov-9/+8
The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s.
2021-10-17Rollup merge of #89963 - r00ster91:parenthesisparentheses, r=nagisaMatthias Krüger-10/+10
Some "parenthesis" and "parentheses" fixes "Parenthesis" is the singular (e.g. one `(` or one `)`) and "parentheses" is the plural (multiple `(` or `)`s) and this is not hard to mix up so here are some fixes for that. Inspired by #89958
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-10/+10
2021-10-15Fix clippy with for loop span changeCameron Steffen-7/+1
2021-10-15Fix clippy with changed macro statement spansCameron Steffen-130/+126
2021-10-13Update clippy ui outputOli Scherer-1/+1
2021-10-12Auto merge of #89770 - jkugelman:must-use-from-and-into, r=joshtriplettbors-150/+150
Add #[must_use] to From::from and Into::into Risk of churn: **High** Magic 8-Ball says: **Outlook not so good** I figured I'd put this out there. If we don't do it now maybe we save it for a rainy day. Parent issue: #89692 r? `@joshtriplett`
2021-10-11Add #[must_use] to From::from and Into::intoJohn Kugelman-150/+150
2021-10-11Deprecate mem_discriminant_non_enumflip1995-314/+15
This lint has been uplifted and is now included in enum_intrinsics_non_enums.
2021-10-07Merge commit 'b7f3f7f6082679da2da9a0b3faf1b5adef3afd3b' into clippyupflip1995-2940/+4259
2021-10-03Auto merge of #88175 - camsteffen:let-desugar-span, r=Manishearthbors-14/+11
Add expansion to while desugar spans In the same vein as #88163, this reverts a change in Clippy behavior as a result of #80357 (and reverts some `#[allow]`s): This changes `clippy::blocks_in_if_conditions` to not fire on `while` loops. Though we might actually want Clippy to lint those cases, we should introduce the change purposefully, with tests, and possibly under a different lint name. The actual change here is to add a desugaring expansion to the spans when lowering a `while` loop. r? `@Manishearth`
2021-10-02Make diangostic item names consistentCameron Steffen-193/+196
2021-10-02Add desugaring mark to while loopCameron Steffen-14/+11
2021-10-01Auto merge of #89449 - Manishearth:rollup-3alb61f, r=Manishearthbors-2/+1
Rollup of 7 pull requests Successful merges: - #85223 (rustdoc: Clarified the attribute which prompts the warning) - #88847 (platform-support.md: correct ARMv7+MUSL platform triple notes) - #88963 (Coerce const FnDefs to implement const Fn traits ) - #89376 (Fix use after drop in self-profile with llvm events) - #89422 (Replace whitespaces in doctests' name with dashes) - #89440 (Clarify a sentence in the documentation of Vec (#84488)) - #89441 (Normalize after substituting via `field.ty()`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-01Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obkManish Goregaokar-2/+1
Coerce const FnDefs to implement const Fn traits You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`. r? ``@oli-obk`` ``@rustbot`` label T-compiler F-const_trait_impl
2021-10-01Auto merge of #88880 - cjgillot:no-krate, r=oli-obkbors-28/+27
Rework HIR API to make invocations of the hir_crate query harder. `hir_crate` forces the recomputation of queries that depend on it. This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.
2021-09-30Rollup merge of #88782 - asquared31415:issue-79559, r=cjgillotManish Goregaokar-3/+4
Fix ICE when `start` lang item has wrong generics In my previous pr #87875 I missed the requirements on the `start` lang item due to its relative difficulty to test and opting for more conservative estimates. This fixes that by updating the requirement to be exactly one generic type. The `start` lang item should have exactly one generic type for the return type of the `main` fn ptr passed to it. I believe having zero would previously *sometimes* compile (often with the use of `fn() -> ()` as the fn ptr but it was likely UB to call if the return type of `main` was not `()` as far as I know) however it also sometimes would not for various errors including ICEs and LLVM errors depending on exact situations. Having more than 1 generic has always failed with an ICE because only the one generic type is expected and provided. Fixes #79559, fixes #73584, fixes #83117 (all duplicates) Relevant to #9307 r? ````@cjgillot````
2021-09-30Do not pass hir::Crate to lints.Camille GILLOT-25/+26
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-5/+3
2021-09-28Merge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyupflip1995-1001/+2220
2021-09-25Rollup merge of #89216 - r00ster91:bigo, r=dtolnayManish Goregaokar-1/+1
Consistent big O notation This makes the big O time complexity notation in places with markdown support more consistent. Inspired by #89210
2021-09-25Auto merge of #89030 - nbdd0121:box2, r=jonas-schievinkbors-0/+1
Introduce `Rvalue::ShallowInitBox` Polished version of #88700. Implements MCP rust-lang/compiler-team#460, and should allow #43596 to go forward. In short, creating an empty box is split from a nullary-op `NullOp::Box` into two steps, first a call to `exchange_malloc`, then a `Rvalue::ShallowInitBox` which transmutes `*mut u8` to a shallow-initialized `Box<T>`. This allows the `exchange_malloc` call to unwind. Details can be found in the MCP. `NullOp::Box` is not yet removed, purely to make reverting easier in case anything goes wrong as the result of this PR. If revert is needed a reversion of "Use Rvalue::ShallowInitBox for box expression" commit followed by a test bless should be sufficient. Experiments in #88700 showed a very slight compile-time perf regression due to (supposedly) slightly more time spent in LLVM. We could omit unwind edge generation (in non-`oom=panic` case) in box expression MIR construction to restore perf; but I don't think it's necessary since runtime perf isn't affected and perf difference is rather small.
2021-09-25Introduce `Rvalue::ShallowInitBox`Gary Guo-0/+1
2021-09-24Rollup merge of #89001 - jackh726:binder-cleanup, r=nikomatsakisJubilee-3/+3
Be explicit about using Binder::dummy This is somewhat of a late followup to the binder refactor PR. It removes `ToPredicate` and `ToPolyTraitImpls` that hide the use of `Binder::dummy`. While this does make code a bit more verbose, it allows us be more careful about where we create binders. Another alternative here might be to add a new trait `ToBinder` or something with a `dummy()` fn. Which could still allow grepping but allows doing something like `trait_ref.dummy()` (but I also wonder if longer-term, it would be better to be even more explicit with a `bind_with_vars(ty::List::empty())` *but* that's not clear yet. r? ``@nikomatsakis``
2021-09-24consistent big O notationr00ster91-1/+1
2021-09-23Auto merge of #89139 - camsteffen:write-perf, r=Mark-Simulacrumbors-20/+15
Use ZST for fmt unsafety as suggested here - https://github.com/rust-lang/rust/pull/83302#issuecomment-923529151.
2021-09-21Rollup merge of #89078 - camsteffen:map-ref, r=cjgillotthe8472-12/+6
Cleanup: Remove needless reference in ParentHirIterator It forces an intermediate binding of `Map` which is a Copy type.
2021-09-21Use ZST for fmt unsafetyCameron Steffen-20/+15
This allows the format_args! macro to keep the pre-expansion code out of the unsafe block without doing gymnastics with nested `match` expressions. This reduces codegen.
2021-09-20Do not store visibility in *ItemRef.Camille GILLOT-1/+1
2021-09-18Remove needless hir Map refCameron Steffen-12/+6
2021-09-16Fix clippyjackh726-3/+3
2021-09-15Move is_const_fn to under TyCtxtDeadbeef-2/+1
2021-09-14update testasquared31415-3/+4
2021-09-13Update permissions path for clippy lintGuillaume Gomez-1/+1
2021-09-13Auto merge of #88517 - smoelius:without-patch-versions, r=flip1995bors-44/+36
Update Clippy dependencies without patch versions Trial run for https://github.com/rust-lang/rust-clippy/pull/7606
2021-09-12Auto merge of #88839 - nbdd0121:alignof, r=nagisabors-1/+1
Introduce NullOp::AlignOf This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`. The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.
2021-09-13Introduce NullOp::AlignOfGary Guo-1/+1
2021-09-12Rollup merge of #88677 - petrochenkov:exportid, r=davidtwcoManish Goregaokar-2/+2
rustc: Remove local variable IDs from `Export`s Local variables can never be exported.
2021-09-11Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkovbors-10/+13
Encode spans relative to the enclosing item The aim of this PR is to avoid recomputing queries when code is moved without modification. MCP at https://github.com/rust-lang/compiler-team/issues/443 This is achieved by : 1. storing the HIR owner LocalDefId information inside the span; 2. encoding and decoding spans relative to the enclosing item in the incremental on-disk cache; 3. marking a dependency to the `source_span(LocalDefId)` query when we translate a span from the short (`Span`) representation to its explicit (`SpanData`) representation. Since all client code uses `Span`, step 3 ensures that all manipulations of span byte positions actually create the dependency edge between the caller and the `source_span(LocalDefId)`. This query return the actual absolute span of the parent item. As a consequence, any source code motion that changes the absolute byte position of a node will either: - modify the distance to the parent's beginning, so change the relative span's hash; - dirty `source_span`, and trigger the incremental recomputation of all code that depends on the span's absolute byte position. With this scheme, I believe the dependency tracking to be accurate. For the moment, the spans are marked during lowering. I'd rather do this during def-collection, but the AST MutVisitor is not practical enough just yet. The only difference is that we attach macro-expanded spans to their expansion point instead of the macro itself.
2021-09-11Rebase fallout.Camille GILLOT-3/+3
2021-09-11Auto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, ↵bors-10/+9
r=nagisa rustc: use more correct span data in for loop desugaring Fixes #82462 Before: help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | LL | for x in DroppingSlice(&*v).iter(); { | + After: help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | LL | }; | + This seems like a reasonable fix: since the desugared "expr_drop_temps_mut" contains the entire desugared loop construct, its span should contain the entire loop construct as well.
2021-09-10rustc: Remove local variable IDs from `Export`sVadim Petrochenkov-2/+2
Local variables can never be exported.
2021-09-10Keep a parent LocalDefId in SpanData.Camille GILLOT-7/+10
2021-09-09Ignore automatically derived impls of `Clone` and `Debug` in dead code analysisFabian Wolff-30/+11
2021-09-09Update dependenciesSamuel E. Moelius III-34/+32
2021-09-09Prep for upgrade to cargo_metadata 0.14.0Samuel E. Moelius III-10/+4
2021-09-08Auto merge of #88615 - flip1995:clippyup, r=Manishearthbors-1284/+4139
Update Clippy r? `@Manishearth`
2021-09-08Merge commit '27afd6ade4bb1123a8bf82001629b69d23d62aff' into clippyupflip1995-1285/+4143