about summary refs log tree commit diff
path: root/clippy_lints/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2025-02-20Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-1/+3
2025-02-18remove an unneeded `#![feature]`cyrgani-1/+0
2025-02-09Add `single_option_map` lint (#14033)llogiq-0/+2
Checks for functions with method calls to `.map(_)` on an arg of type `Option` as the outermost expression. Fixes #774 ``` changelog: [`single_option_map`]: Checks for functions with method calls to `.map(_)` on an arg of type `Option` as the outermost expression. ```
2025-02-09Add single_option_map lintYusuf Raji-0/+2
2025-02-07Convert `EMPTY_LINE_AFTER_OUTER_ATTR` and `EMPTY_LINE_AFTER_OUTER_ATTR` lint ↵Guillaume Gomez-0/+2
into early lints
2025-02-07add MSRV check for `lines_filter_map_ok` (#14130)Catherine Flores-1/+1
fixes #14127 changelog: [`lines_filter_map_ok`]: respect MSRV
2025-02-06Merge commit '3e3715c31236bff56f1c63a1de2c7bbdfcfb0923' into ↵Philipp Krones-0/+2
clippy-subtree-update
2025-02-01add MSRV check for `lines_filter_map_ok`lapla-cogito-1/+1
2025-01-28Merge commit '51d49c1ae2785b24ef18a46ef233fc1d91844666' into ↵Philipp Krones-1/+7
clippy-subtree-update
2025-01-26new `manual_option_as_slice` lintAndre Bogus-0/+2
2025-01-24add new lint `non_std_lazy_statics`J-ZhengLi-0/+2
detect usage of `once_cell::sync::Lazy` and `lazy_static!`, recommending usage of `std::sync::LazyLock` instead
2025-01-22`unnecessary_semicolon`: do not lint if it may cause borrow errorsSamuel Tardieu-1/+1
Before edition 2024, some temporaries used in scrutinees in a `match` used as the last expression of a block may outlive some referenced local variables. Prevent those cases from happening by checking that alive temporaries with significant drop do have a static lifetime. The check is performed only for edition 2021 and earlier, and for the last statement if it would become the last expression of the block.
2025-01-19New lint: `unnecessary_semicolon`Samuel Tardieu-0/+2
2025-01-13Rust 1.81 and later support elision with explicit self typesSamuel Tardieu-1/+1
Commit 9ef6e2199c885ffd671b321dfbf16ff0934f4d80 introduced a check to ensure that Clippy doesn't consider a lifetime present in an explicit self type as being the default for an elided output lifetime. For example, elision did not work in the case like: ```rust fn func(self: &Rc<Self>, &str) -> &str { … } ``` Since Rust 1.81.0, the lifetime in the self type is now considered the default for elision. Elision should then be suggested when appropriate.
2025-01-12Add new lint `unneeded_struct_pattern` (#13465)Catherine Flores-0/+2
Closes #13400. changelog: [`unneeded_struct_pattern`]: Add new lint
2025-01-09Merge commit '19e305bb57a7595f2a8d81f521c0dd8bf854e739' into ↵Philipp Krones-1/+5
clippy-subtree-update
2024-12-27Make `inconsistent_struct_constructor` "all fields are shorthand" ↵Timo-1/+5
requirement configurable (#13737) Fixes #11846. This PR has three commits: - The first commit adds an `initializer-suggestions` configuration to control suggestion applicability when initializers are present. The following are the options: - "none": do not suggest - "maybe-incorrect": suggest, but do not apply suggestions with `--fix` - "machine-applicable": suggest and apply suggestions with `--fix` - The second commit fixes suggestions to handle field attributes (problem [noticed by @samueltardieu](https://github.com/rust-lang/rust-clippy/pull/13737#discussion_r1859261645)). - The third commit adds `initializer-suggestions = "machine-applicable"` to Clippy's `clippy.toml` and applies the suggestions. (Nothing seems to break.) --- changelog: make `inconsistent_struct_constructor` "all fields are shorthand" requirement configurable
2024-12-26Make "all fields are shorthand" requirement configurableSamuel Moelius-1/+5
Handle field attributes in suggestions Fix adjacent code Address review comments https://github.com/rust-lang/rust-clippy/pull/13737#discussion_r1861352124 Address all review comments but one This comment is not yet addressed: https://github.com/rust-lang/rust-clippy/pull/13737#discussion_r1874544907 `initializer_suggestions` -> `lint_inconsistent_struct_field_initializers`
2024-12-26Merge commit '609cd310be44677ae31d452a17b0f8207e1abfe1' into ↵Philipp Krones-1/+6
clippy-subtree-update
2024-12-26Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-1/+6
2024-12-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dönszelmann-1/+1
2024-12-16Correctly handle string indices in `literal_string_with_formatting_arg`Guillaume Gomez-0/+1
2024-12-15Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-1/+5
2024-12-15Add new lint `unneeded_struct_pattern`Asuna-0/+2
2024-12-02Drop uplifted `clippy::fn_address_comparisons`Urgau-2/+0
2024-11-22Limit `literal_string_with_formatting_args` to known variables if no ↵Guillaume Gomez-1/+1
formatting argument is passed
2024-11-22Rename `literal_string_with_formatting_arg` into ↵Guillaume Gomez-3/+3
`literal_string_with_formatting_args`
2024-11-22Allow `literal_string_with_formatting_arg` in some clippy cratesGuillaume Gomez-1/+2
2024-11-19Add new `literal_string_with_formatting_arg` lintGuillaume Gomez-0/+3
2024-11-07Merge commit 'f712eb5cdccd121d0569af12f20e6a0fabe4364d' into ↵Philipp Krones-1/+11
clippy-subtree-update
2024-11-07Merge pull request #13657 from jdonszelmann/disallowed-macros-to-earlyPhilipp Krones-1/+8
collect attribute spans early for disallowed macros
2024-11-07Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-0/+3
2024-11-05collect attribute spans early for disallowed macrosJonathan Dönszelmann-1/+8
2024-11-04Move two attribute lints to be early pass (post expansion)Jonathan Dönszelmann-0/+2
2024-10-30new lint: `source_item_ordering`decryphe-0/+2
2024-10-19Apply review comments + use `shallow_lint_levels_on`blyxyas-1/+1
2024-10-19Remove module passes filteringblyxyas-1/+1
2024-10-19Follow review comments (optimize the filtering)blyxyas-0/+3
2024-10-18Auto merge of #13543 - GnomedDev:symbol-comparisons, r=y21bors-0/+1
Add internal lint to check for slow symbol comparisons See the conversation on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Checking.20a.20Symbol.20is.20equal.20to.20a.20string.20literal). changelog: none
2024-10-18Merge commit 'a109190d7060236e655fc75533373fa274ec5343' into ↵Philipp Krones-5/+12
clippy-subtree-update
2024-10-18Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-5/+12
2024-10-15Add lint for unnecessary lifetime bounded &str returnGnomedDev-0/+2
2024-10-13Add lint to check for slow symbol comparisonsGnomedDev-0/+1
2024-10-13Auto merge of #13510 - alex-semenyuk:cleanup_const_float_classify, r=llogiqbors-1/+1
Cleanup `const_float_classify` As mentioned at #13508 `const_float_classify` has been stabilized recently in https://github.com/rust-lang/rust/pull/130157 and can be cleanup Close #13508 changelog: [none]
2024-10-13Auto merge of #13334 - nyurik:ascii-str-eq, r=xFrednetbors-0/+2
Add manual_ignore_cast_cmp lint ```rust // bad fn compare(a: &str, b: &str) -> bool { a.to_ascii_lowercase() == b.to_ascii_lowercase() || a.to_ascii_lowercase() == "abc" } // good fn compare(a: &str, b: &str) -> bool { a.eq_ignore_ascii_case(b) || a.eq_ignore_ascii_case("abc") } ``` - [x] Followed [lint naming conventions][lint_naming] - [x] Added passing UI tests (including committed `.stderr` file) - [x] `cargo test` passes locally - [x] Executed `cargo dev update_lints` - [x] Added lint documentation - [x] Run `cargo dev fmt` changelog: New lint: [`manual_ignore_case_cmp`] `perf` [#13334](https://github.com/rust-lang/rust-clippy/pull/13334) Closes #13204
2024-10-12Rollup merge of #131277 - ↵Matthias Krüger-2/+0
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-11Auto merge of #13359 - blyxyas:declare_clippy_macro, r=Alexendoobors-4/+7
Turn declare_clippy_lint into a declarative macro Ease of development, and hopefully compile times (the dependencies are still there because of ui-test). The procedural macro was doing just some very basic processing (like assigning a lint level to each category), so it didn't have a reason to stay IMO changelog: None
2024-10-10Clean up const_float_classify leftoversAlexey Semenyuk-1/+1
2024-10-05Handle `clippy` cases of `rustc::potential_query_instability` lintismailarilik-2/+0
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.