about summary refs log tree commit diff
path: root/src/tools/clippy
AgeCommit message (Collapse)AuthorLines
2024-10-05Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errorsbors-39/+14
Make opaque types regular HIR nodes Having opaque types as HIR owner introduces all sorts of complications. This PR proposes to make them regular HIR nodes instead. I haven't gone through all the test changes yet, so there may be a few surprises. Many thanks to `@camelid` for the first draft. Fixes https://github.com/rust-lang/rust/issues/129023 Fixes #129099 Fixes #125843 Fixes #119716 Fixes #121422
2024-10-04Rollup merge of #129517 - cjgillot:known-panic-array, r=pnkfelixJubilee-5/+9
Compute array length from type for unconditional panic lint. Fixes https://github.com/rust-lang/rust/issues/98444 The cases that involve slicing are harder, so https://github.com/rust-lang/rust/issues/38035 remains open.
2024-10-05Bless clippy.Camille GILLOT-5/+9
2024-10-04Adapt clippy.Camille GILLOT-38/+13
2024-10-04rm `ItemKind::OpaqueTy`Noah Lev-1/+1
This introduce an additional collection of opaques on HIR, as they can no longer be listed using the free item list.
2024-10-04Rollup merge of #130518 - scottmcm:stabilize-controlflow-extra, r=dtolnayJubilee-2/+0
Stabilize the `map`/`value` methods on `ControlFlow` And fix the stability attribute on the `pub use` in `core::ops`. libs-api in https://github.com/rust-lang/rust/issues/75744#issuecomment-2231214910 seemed reasonably happy with naming for these, so let's try for an FCP. Summary: ```rust impl<B, C> ControlFlow<B, C> { pub fn break_value(self) -> Option<B>; pub fn map_break<T>(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C>; pub fn continue_value(self) -> Option<C>; pub fn map_continue<T>(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T>; } ``` Resolves #75744 ``@rustbot`` label +needs-fcp +t-libs-api -t-libs --- Aside, in case it keeps someone else from going down the same dead end: I looked at the `{break,continue}_value` methods and tried to make them `const` as part of this, but that's disallowed because of not having `const Drop`, so put it back to not even unstably-const.
2024-10-03Rollup merge of #131183 - compiler-errors:opaque-ty-origin, r=estebankMatthias Krüger-6/+5
Refactoring to `OpaqueTyOrigin` Pulled out of a larger PR that uses these changes to do cross-crate encoding of opaque origin, so we can use them for edition 2024 migrations. These changes should be self-explanatory on their own, tho 😄
2024-10-03Merge commit 'aa0d551351a9c15d8a95fdb3e2946b505893dda8' into ↵Philipp Krones-848/+2484
clippy-subtree-update
2024-10-02Use named fields for OpaqueTyOriginMichael Goulet-1/+1
2024-10-02Remove redundant in_trait from hir::TyKind::OpaqueDefMichael Goulet-5/+4
2024-10-01make InterpResult a dedicated type to avoid accidentally discarding the errorRalf Jung-5/+5
2024-09-26Rollup merge of #130912 - estebank:point-at-arg-type, r=compiler-errorsJubilee-2/+2
On implicit `Sized` bound on fn argument, point at type instead of pattern Instead of ``` error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time --> $DIR/issue-59324.rs:23:20 | LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} | ^^^^^^^ doesn't have a size known at compile-time ``` output ``` error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time --> $DIR/issue-59324.rs:23:29 | LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time ```
2024-09-27On implicit `Sized` bound on fn argument, point at type instead of patternEsteban Küber-2/+2
Instead of ``` error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time --> $DIR/issue-59324.rs:23:20 | LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} | ^^^^^^^ doesn't have a size known at compile-time ``` output ``` error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time --> $DIR/issue-59324.rs:23:29 | LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time ```
2024-09-25Remove the `control_flow_enum` feature from clippyScott McMurray-2/+0
2024-09-25Auto merge of #130778 - flip1995:clippy-subtree-update, r=Manishearthbors-2572/+7430
Clippy subtree update r? `@Manishearth` Really delayed sync (2 1/2 weeks), because of a `debug_assertion` we hit, and I didn't have the time to investigate earlier. It would be nice to merge this PR with some priority, as it includes a lot of formatting changes due to the rustfmt bump. Include Cargo.lock update due to Clippy version bump and ui_test bump in Clippy.
2024-09-24Rollup merge of #130764 - compiler-errors:inherent, r=estebankTrevor Gross-14/+5
Separate collection of crate-local inherent impls from error tracking #119895 changed the return type of the `crate_inherent_impls` query from `CrateInherentImpls` to `Result<CrateInherentImpls, ErrorGuaranteed>` to avoid needing to use the non-parallel-friendly `track_errors()` to track if an error was reporting from within the query... This was mostly fine until #121113, which stopped halting compilation when we hit an `Err(ErrorGuaranteed)` in the `crate_inherent_impls` query. Thus we proceed onwards to typeck, and since a return type of `Result<CrateInherentImpls, ErrorGuaranteed>` means that the query can *either* return one of "the list inherent impls" or "error has been reported", later on when we want to assemble method or associated item candidates for inherent impls, we were just treating any `Err(ErrorGuaranteed)` return value as if Rust had no inherent impls defined anywhere at all! This leads to basically every inherent method call failing with an error, lol, which was reported in #127798. This PR changes the `crate_inherent_impls` query to return `(CrateInherentImpls, Result<(), ErrorGuaranteed>)`, i.e. returning the inherent impls collected *and* whether an error was reported in the query itself. It firewalls the latter part of that query into a new `crate_inherent_impls_validity_check` just for the `ensure()` call. This fixes #127798.
2024-09-24be even more precise about "cast" vs "coercion"Lukas Markeffsky-4/+4
2024-09-24unify dyn* coercions with other pointer coercionsLukas Markeffsky-1/+1
2024-09-24Remove unused import from Clippy versions.py filePhilipp Krones-1/+0
2024-09-24Fix toolsMichael Goulet-14/+5
2024-09-24Hotfix: remove profile from clippy Cargo.tomlPhilipp Krones-7/+0
2024-09-24Merge commit '7901289135257ca0fbed3a5522526f95b0f5edba' into ↵Philipp Krones-2571/+7437
clippy-subtree-update
2024-09-21Fix clippyBen Kimock-1/+1
2024-09-20Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errorsbors-92/+122
Disallow hidden references to mutable static Closes #123060 Tracking: - https://github.com/rust-lang/rust/issues/123758
2024-09-20[Clippy] Remove final std paths for diagnostic itemGnomedDev-25/+18
2024-09-19Categorise paths in `clippy_utils::paths`GnomedDev-13/+20
2024-09-19[Clippy] Swap `open_options` to use diagnostic items instead of pathsGnomedDev-13/+12
2024-09-19[Clippy] Swap `iter_over_hash_type` to use diagnostic items instead of pathsGnomedDev-32/+14
2024-09-19[Clippy] Swap `non_octal_unix_permissions` to use diagnostic item instead of ↵GnomedDev-4/+1
path
2024-09-19[Clippy] Swap `unnecessary_owned_empty_strings` to use diagnostic item ↵GnomedDev-3/+1
instead of path
2024-09-19[Clippy] Swap `manual_strip` to use diagnostic items instead of pathsGnomedDev-8/+5
2024-09-19[Clippy] Swap `unnecessary_to_owned` to use diagnostic item instead of pathGnomedDev-3/+2
2024-09-19[Clippy] Swap `instant_subtraction` to use diagnostic item instead of pathGnomedDev-2/+1
2024-09-19[Clippy] Swap `waker_clone_wake` to use diagnostic item instead of pathGnomedDev-3/+2
2024-09-19[Clippy] Swap `filter_map_bool_then` to use diagnostic item instead of pathGnomedDev-4/+2
2024-09-19[Clippy] Swap `manual_while_let_some` to use diagnostic items instead of pathsGnomedDev-11/+7
2024-09-19[Clippy] Swap `repeat_vec_with_capacity` to use diagnostic item instead of pathGnomedDev-7/+6
2024-09-19[Clippy] Swap `VecArgs::hir` to use diagnostic items instead of pathsGnomedDev-8/+5
2024-09-19[Clippy] Swap `single_char_add_str`/`format_push_string` to use diagnostic ↵GnomedDev-7/+5
items instead of paths
2024-09-19[Clippy] Swap `manual_main_separator_str` to use diagnostic item instead of pathGnomedDev-3/+2
2024-09-19[Clippy] Swap `redundant_clone` to use diagnostic items instead of pathsGnomedDev-5/+3
2024-09-19[Clippy] Swap `float_equality_without_abs` to use diagnostic items instead ↵GnomedDev-5/+3
of paths
2024-09-19[Clippy] Swap `option_as_ref_deref` to use diagnostic items instead of pathsGnomedDev-19/+12
2024-09-19[Clippy] Swap `lines_filter_map_ok` to use a diagnostic item instead of pathGnomedDev-3/+2
2024-09-19[Clippy] Swap `map_entry` to use diagnostic items instead of pathsGnomedDev-10/+6
2024-09-18[Clippy] Swap `manual_retain` to use diagnostic items instead of pathsGnomedDev-26/+17
2024-09-15Rollup merge of #130293 - gurry:130142-lint-level-issue, r=cjgillotMatthias Krüger-1/+9
Fix lint levels not getting overridden by attrs on `Stmt` nodes Fixes #130142. See comments on the issue for context. r? `@cjgillot`
2024-09-15stabilize const_mut_refsRalf Jung-31/+29
2024-09-14stabilize `const_extern_fn`Folkert de Vries-122/+111
2024-09-14Fix lint levels not getting overridden by attrs on `Stmt` nodesGurinder Singh-1/+9