Skip to content

clippy::complexity fixes #116209

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

Closed
wants to merge 1 commit into from
Closed

Conversation

matthiaskrgr
Copy link
Member

match_single_binding
needless_question_mark
redundant_slicing
derivable_impls
filter_next

match_single_binding
needless_question_mark
redundant_slicing
derivable_impls
filter_next
@rustbot
Copy link
Collaborator

rustbot commented Sep 27, 2023

r? @petrochenkov

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 27, 2023
@rustbot
Copy link
Collaborator

rustbot commented Sep 27, 2023

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Comment on lines +23 to 24
.find(filter_array_elements(tcx, query.param_env))
.is_some();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.find(filter_array_elements(tcx, query.param_env))
.is_some();
.any(filter_array_elements(tcx, query.param_env));

Comment on lines +58 to 59
.find(filter_array_elements(tcx, query.param_env))
.is_some();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.find(filter_array_elements(tcx, query.param_env))
.is_some();
.any(filter_array_elements(tcx, query.param_env));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error[E0277]: expected a `std::ops::FnMut<(Result<rustc_middle::ty::Ty<'tcx>, AlwaysRequiresDrop>,)>` closure, found `impl for<'a> Fn(&'a Result<rustc_middle::ty::Ty<'_>, AlwaysRequiresDrop>) -> bool`
    --> compiler/rustc_ty_utils/src/needs_drop.rs:58:10
     |
58   |     .any(filter_array_elements(tcx, query.param_env));
     |      --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnMut<(Result<rustc_middle::ty::Ty<'tcx>, AlwaysRequiresDrop>,)>` closure, found `impl for<'a> Fn(&'a Result<rustc_middle::ty::Ty<'_>, AlwaysRequiresDrop>) -> bool`
     |      |
     |      required by a bound introduced by this call
     |
     = help: the trait `std::ops::FnMut<(Result<rustc_middle::ty::Ty<'tcx>, AlwaysRequiresDrop>,)>` is not implemented for `impl for<'a> Fn(&'a Result<rustc_middle::ty::Ty<'_>, AlwaysRequiresDrop>) -> bool`
     = note: expected a closure with arguments `(&Result<rustc_middle::ty::Ty<'_>, AlwaysRequiresDrop>,)`
                found a closure with arguments `(Result<rustc_middle::ty::Ty<'tcx>, AlwaysRequiresDrop>,)`
note: required by a bound in `std::iter::Iterator::any`
    --> /home/matthias/vcs/github/rust/library/core/src/iter/traits/iterator.rs:2857:12
     |
2854 |     fn any<F>(&mut self, f: F) -> bool
     |        --- required by a bound in this associated function
...
2857 |         F: FnMut(Self::Item) -> bool,
     |            ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::any`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to fix it by introducing a closure

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, just edit the signature of filter_array_elements to take a Result<Ty<'tcx>, NeedsDrop> rather than a &Result<..>?

@petrochenkov
Copy link
Contributor

@rustbot author to address the comments above

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 28, 2023
@bors
Copy link
Collaborator

bors commented Nov 8, 2023

☔ The latest upstream changes (presumably #117692) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC
Copy link
Member

@matthiaskrgr any updates on this? thanks

@Dylan-DPC
Copy link
Member

Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks

@Dylan-DPC Dylan-DPC closed this Jul 31, 2024
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 31, 2024
@matthiaskrgr matthiaskrgr deleted the clippy2 branch January 25, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants