about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-09-06 23:49:53 +0200
committerGitHub <noreply@github.com>2025-09-06 23:49:53 +0200
commit1123d49090e29ae2f4dd4131ababa9a41d45e637 (patch)
treef3fd368f67c4679d1b48bbef70263e055bcc59d8
parent4b9b0265a067a76cde6a2bed966507c12bdc04af (diff)
parent05659c99c9fc76ebd9e314f3e07c85df142e7456 (diff)
downloadrust-1123d49090e29ae2f4dd4131ababa9a41d45e637.tar.gz
rust-1123d49090e29ae2f4dd4131ababa9a41d45e637.zip
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)]`
```
-rw-r--r--compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs b/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs
index 1280ab1442a..0737a18384b 100644
--- a/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs
+++ b/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs
@@ -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))
         .count();
 
     // We do not know their size anymore at this level, so hardcode a placeholder.