about summary refs log tree commit diff
path: root/src/tools/clippy/clippy_utils
AgeCommit message (Collapse)AuthorLines
2021-11-21Fix Clippy with changed for loop desugarCameron Steffen-47/+15
2021-11-09Auto merge of #90485 - camsteffen:fmt-args-less-bind, r=m-ou-sebors-10/+4
Don't destructure args tuple in format_args! This allows Clippy to parse the HIR more simply since `arg0` is changed to `_args.0`. (cc rust-lang/rust-clippy#7843). From rustc's perspective, I think this is something between a lateral move and a tiny improvement since there are fewer bindings. r? `@m-ou-se`
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-9/+16
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-06Fix Clippy with changed format_args!Cameron Steffen-10/+4
2021-11-04Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyupflip1995-142/+325
2021-10-21Merge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyupflip1995-39/+268
2021-10-20Remove NullOp::BoxGary Guo-1/+0
2021-10-20Rollup merge of #88860 - nbdd0121:panic, r=m-ou-seYuki Okushi-3/+0
Deduplicate panic_fmt std's begin_panic_fmt and core's panic_fmt are duplicates. Merge them to declutter code and remove a lang item.
2021-10-19Remove begin_panic_fmt from clippyGary Guo-3/+0
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-3/+3
2021-10-07Merge commit 'b7f3f7f6082679da2da9a0b3faf1b5adef3afd3b' into clippyupflip1995-13/+37
2021-10-02Make diangostic item names consistentCameron Steffen-14/+14
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-09-28Merge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyupflip1995-56/+74
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-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-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-18Remove needless hir Map refCameron Steffen-12/+6
2021-09-15Move is_const_fn to under TyCtxtDeadbeef-2/+1
2021-09-13Update permissions path for clippy lintGuillaume Gomez-1/+1
2021-09-13Auto merge of #88517 - smoelius:without-patch-versions, r=flip1995bors-2/+2
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-10rustc: Remove local variable IDs from `Export`sVadim Petrochenkov-2/+2
Local variables can never be exported.
2021-09-09Update dependenciesSamuel E. Moelius III-2/+2
2021-09-08Auto merge of #88615 - flip1995:clippyup, r=Manishearthbors-164/+519
Update Clippy r? `@Manishearth`
2021-09-08Merge commit '27afd6ade4bb1123a8bf82001629b69d23d62aff' into clippyupflip1995-164/+519
2021-09-07Rename rustc_mir to rustc_const_eval.Camille GILLOT-2/+2
2021-08-30Fix clippy for let-elseCameron Steffen-1/+11
2021-08-26update `TypeFlags` to deal with missing ct substslcnr-1/+1
2021-08-26add `tcx` to `fn walk`lcnr-9/+9
2021-08-26make unevaluated const substs optionallcnr-5/+1
2021-08-23Auto merge of #83302 - camsteffen:write-piece-unchecked, r=dtolnaybors-15/+20
Get piece unchecked in `write` We already use specialized `zip`, but it seems like we can do a little better by not checking `pieces` length at all. `Arguments` constructors are now unsafe. So the `format_args!` expansion now includes an `unsafe` block. <details> <summary>Local Bench Diff</summary> ```text name before ns/iter after ns/iter diff ns/iter diff % speedup fmt::write_str_macro1 22,967 19,718 -3,249 -14.15% x 1.16 fmt::write_str_macro2 35,527 32,654 -2,873 -8.09% x 1.09 fmt::write_str_macro_debug 571,953 575,973 4,020 0.70% x 0.99 fmt::write_str_ref 9,579 9,459 -120 -1.25% x 1.01 fmt::write_str_value 9,573 9,572 -1 -0.01% x 1.00 fmt::write_u128_max 176 173 -3 -1.70% x 1.02 fmt::write_u128_min 138 134 -4 -2.90% x 1.03 fmt::write_u64_max 139 136 -3 -2.16% x 1.02 fmt::write_u64_min 129 135 6 4.65% x 0.96 fmt::write_vec_macro1 24,401 22,273 -2,128 -8.72% x 1.10 fmt::write_vec_macro2 37,096 35,602 -1,494 -4.03% x 1.04 fmt::write_vec_macro_debug 588,291 589,575 1,284 0.22% x 1.00 fmt::write_vec_ref 9,568 9,732 164 1.71% x 0.98 fmt::write_vec_value 9,516 9,625 109 1.15% x 0.99 ``` </details>
2021-08-23Rollup merge of #88230 - steffahn:a_an, r=oli-obkMara Bos-3/+3
Fix typos “a”→“an” Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an. While automation was used to find these, every change was checked manually. Changes in submodules get separate PRs: * https://github.com/rust-lang/stdarch/pull/1201 * https://github.com/rust-lang/cargo/pull/9821 * https://github.com/rust-lang/miri/pull/1874 * https://github.com/rust-lang/rls/pull/1746 * https://github.com/rust-analyzer/rust-analyzer/pull/9984 _folks @ rust-analyzer are fast at merging…_ * https://github.com/rust-analyzer/rust-analyzer/pull/9985 * https://github.com/rust-analyzer/rust-analyzer/pull/9987 * https://github.com/rust-analyzer/rust-analyzer/pull/9989 _For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._ <hr> This has some overlap with #88226, but neither is a strict superset of the other. If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2021-08-22Rollup merge of #88211 - petrochenkov:withhilo, r=jyn514Guillaume Gomez-1/+1
cleanup: `Span::new` -> `Span::with_lo` Extracted from https://github.com/rust-lang/rust/pull/84373 as suggested in https://github.com/rust-lang/rust/pull/84373#issuecomment-857773867. It turned out less useful then I expected, but anyway. r? `@cjgillot` `@bors` rollup
2021-08-22Fix typos “a”→“an”Frank Steffahn-3/+3
2021-08-22Auto merge of #88163 - camsteffen:collapsible-match-fix, r=Manishearthbors-25/+13
Fix clippy::collapsible_match with let expressions This fixes rust-lang/rust-clippy#7575 which is a regression from #80357. I am fixing the bug here instead of in the clippy repo (if that's okay) because a) the regression has not been synced yet and b) I would like to land the fix on nightly asap. The fix is basically to re-generalize `match` and `if let` for the lint implementation (they were split because `if let` no longer desugars to `match` in the HIR). Also fixes rust-lang/rust-clippy#7586 and fixes rust-lang/rust-clippy#7591 cc `@rust-lang/clippy` `@xFrednet` do you want to review this?
2021-08-21cleanup: `Span::new` -> `Span::with_lo`Vadim Petrochenkov-1/+1
2021-08-19introduce a Coerce predicateNiko Matsakis-0/+3
2021-08-19Fix clippy let expressions falloutCameron Steffen-25/+13
2021-08-16clippy: Fix format_args expansion parsingCameron Steffen-15/+20
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-161/+378
2021-08-13move Constness into TraitPredicateDeadbeef-2/+2
2021-08-12Merge commit '7bfc26ec8e7a454786668e7e52ffe527fc649735' into clippyupflip1995-8/+75
2021-07-29rfc3052: Remove authors field from Cargo manifestsJade-1/+0
Since RFC 3052 soft deprecated the authors field anyway, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information, we should remove it from crates in this repo.
2021-07-29Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyupflip1995-20/+30
2021-07-26Actually infer args in visitorskadmin-3/+3
2021-07-25Add inferred args to typeckkadmin-6/+4
2021-07-25Add generic arg inferkadmin-1/+10