Skip to content

Conversation

hkBst
Copy link
Member

@hkBst hkBst commented Sep 5, 2025

Fixes clippy warning:

warning: this call to `map()` won't have an effect on the call to `count()`
   --> compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:194:25
    |
194 |       let num_ptr_types = types
    |  _________________________^
195 | |         .iter()
196 | |         .map(|&x| matches!(cx.type_kind(x), rustc_codegen_ssa::common::TypeKind::Pointer))
197 | |         .count();
    | |________________^
    |
    = help: make sure you did not confuse `map` with `filter`, `for_each` or `inspect`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_map
    = note: `-W clippy::suspicious-map` implied by `-W clippy::suspicious`
    = help: to override `-W clippy::suspicious` add `#[allow(clippy::suspicious_map)]`

@rustbot
Copy link
Collaborator

rustbot commented Sep 5, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. labels Sep 5, 2025
@@ -193,7 +193,7 @@ fn gen_define_handling<'ll>(
// reference) types.
let num_ptr_types = types
.iter()
.map(|&x| matches!(cx.type_kind(x), rustc_codegen_ssa::common::TypeKind::Pointer))
.filter(|&x| matches!(cx.type_kind(x), rustc_codegen_ssa::common::TypeKind::Pointer))
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks ok to me but I know nothing about this code and will offload the review to @ZuseZ4 as the original author.

@nnethercote nnethercote assigned ZuseZ4 and unassigned nnethercote Sep 6, 2025
@ZuseZ4
Copy link
Member

ZuseZ4 commented Sep 6, 2025

Yes, that was wrong, thanks for your PR. I haven't ran any multi-argument testcases yet since I'm waiting for two of my GPU PRs to be reviewed and merged first, therefore I haven't noticed it yet.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 6, 2025

📌 Commit 05659c9 has been approved by ZuseZ4

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 6, 2025
bors added a commit that referenced this pull request Sep 7, 2025
Rollup of 4 pull requests

Successful merges:

 - #146200 (Simplify rustdoc-gui tester by calling directly browser-ui-test)
 - #146236 (gpu offload: change suspicious map into filter)
 - #146240 (DynamicConfig: use canonical clone impl)
 - #146251 (rustc_middle: clippy fixes)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1123d49 into rust-lang:master Sep 7, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Sep 7, 2025
rust-timer added a commit that referenced this pull request Sep 7, 2025
Rollup merge of #146236 - hkBst:gpu-1, r=ZuseZ4

gpu offload: change suspicious map into filter

Fixes clippy warning:
```text
warning: this call to `map()` won't have an effect on the call to `count()`
   --> compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:194:25
    |
194 |       let num_ptr_types = types
    |  _________________________^
195 | |         .iter()
196 | |         .map(|&x| matches!(cx.type_kind(x), rustc_codegen_ssa::common::TypeKind::Pointer))
197 | |         .count();
    | |________________^
    |
    = help: make sure you did not confuse `map` with `filter`, `for_each` or `inspect`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_map
    = note: `-W clippy::suspicious-map` implied by `-W clippy::suspicious`
    = help: to override `-W clippy::suspicious` add `#[allow(clippy::suspicious_map)]`
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants