about summary refs log tree commit diff
path: root/clippy_utils/src
AgeCommit message (Collapse)AuthorLines
2024-08-24Merge commit '0f8eabd6231366bfc1bb1464601297c2d48f8f68' into clippyupJason Newcomb-106/+140
2024-08-24Merge branch 'master' into rustupJason Newcomb-106/+140
2024-08-24Rewrite empty_line_after_doc_comments and empty_line_after_outer_attrAlex Macleod-72/+15
2024-08-25check std::panic::panic_any in panic lintkyoto7250-0/+1
2024-08-24Auto merge of #12993 - GuillaumeGomez:too_long_first_doc_paragraph, r=Centri3bors-25/+39
Add new `too_long_first_doc_paragraph` first paragraph lint Fixes https://github.com/rust-lang/rust-clippy/issues/12989. changelog: Add new `too_long_first_doc_paragraph` first paragraph lint
2024-08-24Auto merge of #13296 - Jarcho:get_src_display3, r=Alexendoobors-1/+6
Replace more uses of `snippet_opt`. Almost all calls are removed after this. changelog: none
2024-08-21Replace more uses of `snippet_opt`.Jason Newcomb-1/+6
2024-08-21Start removing `snippet_opt`Jason Newcomb-30/+26
2024-08-19Auto merge of #13278 - Alexendoo:misc-cleanup, r=y21bors-5/+0
Misc cleanup changelog: none
2024-08-18rename AddressOf -> RawBorrow inside the compilerRalf Jung-1/+1
2024-08-18Auto merge of #13248 - Alexendoo:format-arg-ast-fallback, r=xFrednetbors-7/+2
Remove `find_format_arg_expr` AST fallback If the function fails where it shouldn't we can fix that directly, but the fallback path is untested as I'm not aware of a case where it would fail changelog: none
2024-08-17Remove duplicate `type_diagnostic_name` functionAlex Macleod-5/+0
2024-08-14Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errorsbors-3/+3
Shrink `TyKind::FnPtr`. By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI. r? `@compiler-errors`
2024-08-12Auto merge of #13255 - Jarcho:get_src_display2, r=Manishearthbors-25/+61
Remove more `snippet_opt` calls First commit is the same as #13244 changelog: none
2024-08-12Auto merge of #13243 - Alexendoo:rustcversion, r=flip1995bors-6/+1
Replace `rustc_semver` with `rustc_session::RustcVersion` Allows dropping a dependency but there is a behaviour change here, the following versions are no longer accepted: * `1` (would need to be `1.0` or `1.0.0`) * `1.0.0-alpha` * `1.0.0-alpha.2` * `1.0.0-beta` But this seems unlikely to effect anybody, I did some GitHub searching and found no occurrences outside our UI tests r? `@flip1995` changelog: none
2024-08-11Remove more instances of `snippet_opt`.Jason Newcomb-1/+10
2024-08-10Remove `find_format_arg_expr` AST fallbackAlex Macleod-7/+2
2024-08-10Fixes in various placesNadrieril-0/+1
2024-08-09Refactor `absolute_paths`:Jason Newcomb-7/+5
* Check the path length first * Use `is_from_proc_macro` * Use symbols instead of strings when checking crate names
2024-08-09Rename `get_source_text` to `get_source_range`. Add new `get_source_text` ↵Jason Newcomb-25/+52
which returns a displayable string-like type.
2024-08-09Replace `rustc_semver` with `rustc_session::RustcVersion`Alex Macleod-6/+1
2024-08-09Auto merge of #128703 - compiler-errors:normalizing-tails, r=lcnrbors-1/+1
Miscellaneous improvements to struct tail normalization 1. Make checks for foreign tails more accurate by normalizing the struct tail. I didn't write a test for this one. 2. Normalize when computing struct tail for `offset_of` for slice/str. This fixes the new solver only. 3. Normalizing when computing tails for disaligned reference check. This fixes both solvers. r? lcnr
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-3/+3
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
2024-08-08Merge commit 'cb806113e0f83a8f9b47d35b453b676543bcc40e' into ↵Philipp Krones-330/+306
clippy-subtree-update
2024-08-08Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-330/+306
2024-08-08Rename struct_tail_erasing_lifetimes to struct_tail_for_codegenMichael Goulet-1/+1
2024-08-08Auto merge of #13200 - Jarcho:constant_no_typeck, r=Alexendoobors-220/+234
Don't use `LateContext` in the constant evaluator This also changes the interface to require explicitly creating the context. `constant` could be added back in, but the others are probably not worth it. A couple of bugs have been fixed. The wrong `TypeckResults` was used once when evaluating a constant, and the wrong `ParamEnv` was used by some callers (there wasn't a way to use the correct one). changelog: none
2024-08-08Require `ConstEvalCtxt` to be constructed.Jason Newcomb-115/+111
2024-08-08Don't store `LateContext` in `ConstEvalLateContext`Jason Newcomb-73/+70
2024-08-08Add `HasSession` traitJason Newcomb-54/+75
2024-08-07Replace `in_constant` with `is_in_const_context`. Use only the state in ↵Jason Newcomb-12/+16
`LateContext` to avoid walking the HIR tree.
2024-08-06Use `-D warnings` instead of `deny-warnings` feature.Jason Newcomb-1/+0
2024-08-04Remove `multispan_sugg[_with_applicability]`Alex Macleod-29/+0
2024-08-03Auto merge of #13115 - tesuji:rm-dup-peels, r=dswijbors-13/+0
Remove duplicated `peel_middle_ty_refs` TODO: Should we move `ty::peel_mid_ty_refs_is_mutable` to super module too? changelog: none
2024-07-29Remove some miscellaneous `#[allow]`sAlex Macleod-2/+1
2024-07-29Fix fix under loop may dropping loop label when applying fix.shenyifu-1/+4
2024-07-28step cfg(bootstrap)Mark Rousskov-1/+0
2024-07-27Auto merge of #13149 - jusexton:issue-13123, r=dswijbors-1/+3
Fix while_let_on_iterator dropping loop label when applying fix. Loop label was not persisted when displaying help and was therefore producing broken rust code when applying fixes. Solution was to store the `ast::Label` when creating a `higher::WhileLet` from an expression and add the label name to the lint suggestion and diagnostics. --- Fixes: https://github.com/rust-lang/rust-clippy/issues/13123 changelog: [`while_let_on_iterator`]: Fix issue dropping loop label when displaying help and applying fixes.
2024-07-26Fix dogfood lintsGuillaume Gomez-25/+39
2024-07-25Auto merge of #13156 - y21:for_each_expr_visitor_refactor, r=xFrednetbors-50/+48
Remove unnecessary `res` field in `for_each_expr` visitors Small refactor in the `for_each_expr*` visitors. This should not change anything functionally. Instead of storing the final value `Option<B>` in the visitor and setting it to `Some` when we get a `ControlFlow::Break(B)` from the closure, we can just directly return it from the visitor itself now that visitors support that. cc #12829 and https://github.com/rust-lang/rust-clippy/pull/12830#discussion_r1627882827 changelog: none
2024-07-25Merge commit '37f4fbb92913586b73a35772efd00eccd1cbbe13' into ↵Philipp Krones-26/+55
clippy-subtree-update
2024-07-25Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-27/+55
2024-07-25get rid of unnecessary `res` field in `for_each_expr` visitorsy21-50/+48
2024-07-24Auto merge of #13146 - Alexendoo:cast-lossless-128, r=y21bors-3/+6
Lint casts to `u128` in `cast_lossless` Reverts #12496 per https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Should.20.60as.20u128.60.20trigger.20cast_lossless Also changes the lint messages and refactors the suggestion production - Fixes #12695 changelog: [`cast_lossless`]: lint casts to `u128`
2024-07-24Lint casts to `u128` in `cast_lossless`Alex Macleod-3/+6
2024-07-24Replace local variables signifying "done" or "loop break", use ControlFlow ↵blyxyas-8/+21
#12830
2024-07-23Fix while_let_on_iterator dropping loop label when applying fix.jusexton-1/+3
2024-07-17Refactor for using config values:Jason Newcomb-13/+24
* Construct lint passes by taking `Conf` by reference. * Use `HashSet` configs in less places * Move some `check_crate` code into the pass constructor when possible.
2024-07-17Remove duplicated peel_middle_ty_refsLzu Tao-13/+0
TODO: Should we move `ty::peel_mid_ty_refs_is_mutable` to super module too?
2024-07-16Add `ConstArgKind::Path` and make `ConstArg` its own HIR nodeNoah Lev-2/+6
This is a very large commit since a lot needs to be changed in order to make the tests pass. The salient changes are: - `ConstArgKind` gets a new `Path` variant, and all const params are now represented using it. Non-param paths still use `ConstArgKind::Anon` to prevent this change from getting too large, but they will soon use the `Path` variant too. - `ConstArg` gets a distinct `hir_id` field and its own variant in `hir::Node`. This affected many parts of the compiler that expected the parent of an `AnonConst` to be the containing context (e.g., an array repeat expression). They have been changed to check the "grandparent" where necessary. - Some `ast::AnonConst`s now have their `DefId`s created in rustc_ast_lowering rather than `DefCollector`. This is because in some cases they will end up becoming a `ConstArgKind::Path` instead, which has no `DefId`. We have to solve this in a hacky way where we guess whether the `AnonConst` could end up as a path const since we can't know for sure until after name resolution (`N` could refer to a free const or a nullary struct). If it has no chance as being a const param, then we create a `DefId` in `DefCollector` -- otherwise we decide during ast_lowering. This will have to be updated once all path consts use `ConstArgKind::Path`. - We explicitly use `ConstArgHasType` for array lengths, rather than implicitly relying on anon const type feeding -- this is due to the addition of `ConstArgKind::Path`. - Some tests have their outputs changed, but the changes are for the most part minor (including removing duplicate or almost-duplicate errors). One test now ICEs, but it is for an incomplete, unstable feature and is now tracked at #127009.