-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Clippy #104688
Update Clippy #104688
Conversation
Rollup of 6 pull requests Successful merges: - rust-lang#102287 (Elaborate supertrait bounds when triggering `unused_must_use` on `impl Trait`) - rust-lang#102922 (Filtering spans when emitting json) - rust-lang#103051 (translation: doc comments with derives, subdiagnostic-less enum variants, more derive use) - rust-lang#103111 (Account for hygiene in typo suggestions, and use them to point to shadowed names) - rust-lang#103260 (Fixup a few tests needing asm support) - rust-lang#103321 (rustdoc: improve appearance of source page navigation bar) Failed merges: - rust-lang#103209 (Diagnostic derives: allow specifying multiple alternative suggestions) r? `@ghost` `@rustbot` modify labels: rollup
Co-authored-by: llogiq <[email protected]>
[`unwrap_used`], [`expect_used`] do not lint in `test` cfg changelog: [`unwrap_used`], [`expect_used`] do not lint in `test` cfg fix rust-lang/rust-clippy#9612 I've updated the doc and used `cfg` acronym, not sure if `conditional compiler flag` would have been better
Enable test no_std_main_recursion Verified that test actually works on windows changelog: none
…p1995 Mark `let_underscore_lock` and `let_underscore_drop` as uplifted Here I've renamed both the uplifted lints, however rustc's `let_underscore_lock` is slightly less capable than the clippy lint as it doesn't catch `parking_lot` types or `Result<Guard, ..>`, should we still remove it? The `Result` change looks like it was unintentional to me so that could probably be fixed upstream changelog: Uplift [`let_underscore_drop`] to rustc rust-lang#97739 changelog: Remove overlap between rustc's `let_underscore_lock` and Clippy's [`let_underscore_lock`] r? `@flip1995`
* add `rest_arg` to pass second argument from `map_or(U, F)` * extract some procedures into closure refac: rename rest_arg/second_arg refac: organize function argument order * put `second_arg` next to `arg` argument
…1995 fix: support `map_or` for `or_fun_call` lint fixes rust-lang/rust-clippy#8993 The methods defined in `KNOW_TYPES`, except for `map_or`, accepts only one argument, so the matching `if let [arg] = args` works only for these methods. This PR adds `rest_arg` argument to `check_general_case` method and handling of cases with two arguments to support `map_or`. changelog: `or_fun_call` support `map_or` * add `rest_arg` to pass second argument from `map_or(U, F)` * extract some procedures into closure
Fix allow_attributes_without_reason applying to external crate macros Previously the `clippy::allow_attributes_without_reason` lint would apply to external crate macros. Many macros in the Rust ecosystem include these `allow` attributes without adding a reason, making this lint pretty much unusable in any sizable Rust project. This commit fixes that by adding a check to the lint if the attribute is from an external crate macro and returning early. ``` changelog: [`allow_attributes_without_reason`]: allow_attributes_without_reason no longer applies to external crate macros ```
…flip1995 Improvement for `equatable_if_let` fixes rust-lang#9221 This PR makes sure that enums or structs not implementing `PartialEq` trait but still using the `if let` patterns can be linted to be rewritten with `matches!`. If you added a new lint, here's a checklist for things that will be checked during review or continuous integration. - \[ ] Followed [lint naming conventions][lint_naming] - \[x] Added passing UI tests (including committed `.stderr` file) - \[x] `cargo test` passes locally - \[ ] Executed `cargo dev update_lints` - \[ ] Added lint documentation - \[x] Run `cargo dev fmt` --- changelog: Improve [`equatable_if_let`] with additional `matches!` suggestions.
add `from_raw_with_void_ptr` lint This PR `fixes rust-lang#9679` - \[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: [`from_raw_with_void_ptr`]: added new lint
Changes it to be a proc_macro rather than macro_rules
Generate lint categories and explanations with `declare_clippy_lint` This means contributors will no longer have to run `cargo dev update_lints` after changing a lints documentation or its category, which may also mean fewer merge conflicts in general It works by swapping `declare_clippy_lint` out for a `proc_macro` of the same name. The proc macro emits a `LintInfo` alongside the generated `Lint` which are gathered into `declared_lint::LINTS`. The categories/explanations are then read from `declared_lint::LINTS` at runtime The removal of `src/docs` is split into a separate commit to be more easily ignored It is slightly slower though, adding a bit under a second to build time. Less noticeable in full builds or with a slower linker (benchmark uses mold) ```bash hyperfine --warmup 2 \ --parameter-list commit "declare-proc-macro,master" \ --command-name "{commit}" \ --setup "git checkout {commit}" \ --prepare "touch clippy_lints/src/lib.rs" \ "cargo build" ``` ``` Benchmark 1: declare-proc-macro Time (mean ± σ): 10.731 s ± 0.154 s [User: 7.739 s, System: 1.791 s] Range (min … max): 10.598 s … 11.125 s 10 runs Benchmark 2: master Time (mean ± σ): 9.422 s ± 0.094 s [User: 7.183 s, System: 1.732 s] Range (min … max): 9.287 s … 9.624 s 10 runs Summary 'master' ran 1.14 ± 0.02 times faster than 'declare-proc-macro' ``` r? `@flip1995` cc `@llogiq` for `--explain` changelog: none
This PR updates the `from_raw_with_void_ptr` lint, which covered `Box::from_raw`, to also cover the `from_raw` static method of the `Rc`, `Arc`, `alloc::rc::Weak` and `alloc::sync::Weak` types. It also improves the description and error messages of this lint. --- changelog: [`from_raw_with_void_ptr`]: Now works with the `Rc`, `Arc`, `alloc::rc::Weak` and `alloc::sync::Weak` types.
Signed-off-by: Doru-Florin Blanzeanu <[email protected]>
Signed-off-by: Doru-Florin Blanzeanu <[email protected]>
Found when working on `lintcheck --fix`
- This name makes more sense and highlights the issue Signed-off-by: Doru-Florin Blanzeanu <[email protected]>
⌛ Testing commit 2422802 with merge 39a4ef785f01329d4de9263d2e9153cdaaacc768... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
Do we use if-let chains a lot? #99938 :/ |
Clippy is probably the main user of |
@bors r=Manishearth,flip1995 |
@bors ping Ahh, typo |
😪 I'm awake I'm awake |
Argh, what's going on with this PR. Seems like GH ignores it and webhooks aren't working on it anymore or something. reopening it, maybe that'll help? |
@bors r=Manishearth,flip1995 |
☀️ Test successful - checks-actions |
Finished benchmarking commit (e221616): comparison URL. Overall result: ❌✅ regressions and improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
…p1995 Update Clippy r? `@Manishearth` Sorry for taking so long. There were so many blockers and so little time. This situation should be mitigated with rust-lang#104007 in the future.
r? @Manishearth
Sorry for taking so long. There were so many blockers and so little time. This situation should be mitigated with #104007 in the future.