summary refs log tree commit diff
path: root/src/tools/clippy/clippy_lints
AgeCommit message (Collapse)AuthorLines
2024-11-19`InterpCx` store `TypingEnv` instead of a `ParamEnv`lcnr-3/+3
2024-11-19remove `TypingMode::from_param_env` in clippylcnr-21/+33
2024-11-19move `fn is_item_raw` to `TypingEnv`lcnr-16/+16
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-56/+57
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-14Merge commit '786fbd6d683933cd0e567fdcd25d449a69b4320c' into ↵Philipp Krones-214/+513
clippy-subtree-update
2024-11-12Consolidate type system const evaluation under `traits::evaluate_const`Boxy-1/+1
mew
2024-11-07Merge commit 'f712eb5cdccd121d0569af12f20e6a0fabe4364d' into ↵Philipp Krones-344/+1511
clippy-subtree-update
2024-11-05Rollup merge of #132637 - blyxyas:lint-less-passes, r=flip1995Matthias Krüger-19/+6
Do not filter empty lint passes & re-do CTFE pass Some structs implement `LintPass` without having a `Lint` associated with them #125116 broke that behaviour by filtering them out. This PR ensures that lintless passes are not filtered out.
2024-11-05Do not filter empty passes & Make CTFE Clippy into lintless passblyxyas-19/+6
2024-11-05Auto merge of #132580 - compiler-errors:globs, r=Noratriebbors-10/+10
Remove unnecessary pub enum glob-imports from `rustc_middle::ty` We used to have an idiom in the compiler where we'd prefix or suffix all the variants of an enum, for example `BoundRegionKind`, with something like `Br`, and then *glob-import* that enum variant directly. `@noratrieb` brought this up, and I think that it's easier to read when we just use the normal style `EnumName::Variant`. This PR is a bit large, but it's just naming. The only somewhat opinionated change that this PR does is rename `BorrowKind::Imm` to `BorrowKind::Immutable` and same for the other variants. I think these enums are used sparingly enough that the extra length is fine. r? `@noratrieb` or reassign
2024-11-04Move two attribute lints to be early pass (post expansion)Jonathan Dönszelmann-75/+101
2024-11-04Remove BorrowKind glob, make names longerMichael Goulet-7/+7
2024-11-04ty::KContainer -> ty::AssocItemContainer::KMichael Goulet-3/+3
2024-10-31Auto merge of #132301 - compiler-errors:adjust, r=lcnrbors-8/+8
Remove region from adjustments It's not necessary to store this region, because it's only used in THIR and MemCat/ExprUse, both of which already basically only deal with erased regions anyways.
2024-10-30Remap impl-trait lifetimes on HIR instead of AST lowering.Camille GILLOT-51/+38
2024-10-29update toolslcnr-9/+10
2024-10-29Remove region from adjustmentsMichael Goulet-8/+8
2024-10-28New lint: `dangling_pointers_from_temporaries`Pavel Grigorenko-1/+1
2024-10-26Auto merge of #125116 - blyxyas:ignore-allowed-lints-final, r=cjgillotbors-10/+64
(Big performance change) Do not run lints that cannot emit Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had `#![allow]`ed them. This PR changes that. This change would improve both the Rust lint infrastructure and Clippy, but Clippy will see the most benefit, as it has about 900 registered lints (and growing!) So yeah, with this little patch we filter all lints pre-linting, and remove any lint that is either: - Manually `#![allow]`ed in the whole crate, - Allowed in the command line, or - Not manually enabled with `#[warn]` or similar, and its default level is `Allow` As some lints **need** to run, this PR also adds **loadbearing lints**. On a lint declaration, you can use the ``@eval_always` = true` marker to label it as loadbearing. A loadbearing lint will never be filtered (it will always run) Fixes #106983
2024-10-26Effects cleanupDeadbeef-1/+1
- removed extra bits from predicates queries that are no longer needed in the new system - removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-3/+3
2024-10-22Represent TraitBoundModifiers as distinct parts in HIRMichael Goulet-13/+13
2024-10-22terminology: #[feature] *enables* a feature (instead of "declaring" or ↵Ralf Jung-5/+1
"activating" it)
2024-10-21Move COGNITIVE_COMPLEXITY to use macro againblyxyas-45/+41
2024-10-21Auto merge of #131988 - matthiaskrgr:rollup-tx173wn, r=matthiaskrgrbors-9/+0
Rollup of 4 pull requests Successful merges: - #126588 (Added more scenarios where comma to be removed in the function arg) - #131728 (bootstrap: extract builder cargo to its own module) - #131968 (Rip out old effects var handling code from traits) - #131981 (Remove the `BoundConstness::NotConst` variant) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-20Rip out old effects var handling code from traitsMichael Goulet-9/+0
2024-10-19Fix testsMichael Goulet-23/+19
2024-10-19Apply review comments + use `shallow_lint_levels_on`blyxyas-2/+2
2024-10-19Remove module passes filteringblyxyas-36/+22
2024-10-19Follow review comments (optimize the filtering)blyxyas-29/+97
2024-10-19Do not run lints that cannot emitblyxyas-5/+9
Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had #![allow]ed them. This PR changes that
2024-10-18Hotfix TRAIT_METHODS static->constPhilipp Krones-1/+2
2024-10-18Merge commit 'a109190d7060236e655fc75533373fa274ec5343' into ↵Philipp Krones-342/+963
clippy-subtree-update
2024-10-14Move trait bound modifiers into hir::PolyTraitRefMichael Goulet-20/+20
2024-10-12Rollup merge of #131277 - ↵Matthias Krüger-34/+32
ismailarilik:handle-potential-query-instability-lint-for-clippy, r=xFrednet Handle `clippy` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/tools/clippy/clippy_lints/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/tools/clippy/clippy_lints/src/lib.rs#L30) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: https://github.com/rust-lang/rust/issues/84447
2024-10-10Auto merge of #13464 - y21:issue13458, r=flip1995bors-1/+1
Don't warn on proc macro generated code in `needless_return` Fixes #13458 Fixes #13457 Fixes #13467 Fixes #13479 Fixes #13481 Fixes #13526 Fixes #13486 The fix is unfortunately a little more convoluted than just simply adding a `is_from_proc_macro`. That check *does* fix the issue, however it also introduces a bunch of false negatives in the tests, specifically when the returned expression is in a different syntax context, e.g. `return format!(..)`. The proc macro check builds up a start and end pattern based on the HIR nodes and compares it to a snippet of the span, however that would currently fail for `return format!(..)` because we would have the patterns `("return", <something inside of the format macro>)`, which doesn't compare equal. So we now return an empty string pattern for when it's in a different syntax context. "Hide whitespace" helps a bit for reviewing the proc macro detection change changelog: none
2024-10-06Rename NestedMetaItem to MetaItemInnercodemountains-20/+20
2024-10-05Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errorsbors-38/+13
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-05Handle `clippy` cases of `rustc::potential_query_instability` lintismailarilik-34/+32
2024-10-04Adapt clippy.Camille GILLOT-38/+13
2024-10-04Rollup merge of #130518 - scottmcm:stabilize-controlflow-extra, r=dtolnayJubilee-1/+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-4/+4
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-331/+647
clippy-subtree-update
2024-10-02Use named fields for OpaqueTyOriginMichael Goulet-1/+1
2024-10-02Remove redundant in_trait from hir::TyKind::OpaqueDefMichael Goulet-3/+3
2024-09-25Remove the `control_flow_enum` feature from clippyScott McMurray-1/+0
2024-09-25Auto merge of #130778 - flip1995:clippy-subtree-update, r=Manishearthbors-1236/+2989
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-24Fix toolsMichael Goulet-7/+2
2024-09-24Merge commit '7901289135257ca0fbed3a5522526f95b0f5edba' into ↵Philipp Krones-1236/+2989
clippy-subtree-update
2024-09-20[Clippy] Remove final std paths for diagnostic itemGnomedDev-6/+6