From 91023de207072ad1fdf08532dfda43510590b14d Mon Sep 17 00:00:00 2001 From: arookieofc Date: Wed, 11 Nov 2026 19:30:15 +0800 Subject: [PATCH] chore(ci): route heap dump dialogs through the platform wrapper; clippy 1.99 and Windows test fixes (#2711) Heap dump open/save use the platform dialog wrapper (GTK fallback on Linux). ide-heap allows clippy 1.99's large_enum_variant on the hot bit table. dialog.test compares paths with forward slashes on Windows. --- crates/ide-heap/src/ids.rs | 3 +++ src/features/debugger/heap/heapDumpFiles.tsx | 7 +++---- src/platform/dialog.test.ts | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/ide-heap/src/ids.rs b/crates/ide-heap/src/ids.rs index d1f613d56..07a2351db 100644 --- a/crates/ide-heap/src/ids.rs +++ b/crates/ide-heap/src/ids.rs @@ -19,6 +19,9 @@ const CHUNK_SLOT_BITS: u32 = 17; const WORD_BITS: u64 = 64; const WORDS_PER_CHUNK: usize = (1 << CHUNK_SLOT_BITS) / WORD_BITS as usize; +// The bit table is matched in hot paths; boxing the big variant would only add +// an indirection to save stack space `IdMap` never holds by value in bulk. +#[allow(clippy::large_enum_variant)] enum Repr { Bits { /// Chunk number of the first table entry. diff --git a/src/features/debugger/heap/heapDumpFiles.tsx b/src/features/debugger/heap/heapDumpFiles.tsx index 9c00bebc3..698fef9ec 100644 --- a/src/features/debugger/heap/heapDumpFiles.tsx +++ b/src/features/debugger/heap/heapDumpFiles.tsx @@ -3,6 +3,7 @@ import { ProgressBar } from "@/ui"; import { setContext } from "@/platform/context"; import { tx, useTx } from "@/platform/i18n"; import { call, commands, IpcError } from "@/platform/ipc"; +import { open as openDialog, save as saveDialog } from "@/platform/dialog"; import { ipcPath } from "@/platform/paths"; import { basename } from "@/platform/project"; import { isRemoteWindow, useRemote } from "@/platform/remote"; @@ -43,8 +44,7 @@ export async function openHeapDump(): Promise { } // One file at a time; the running open keeps its progress notification. if (useHeap.getState().opening) return; - const { open } = await import("@tauri-apps/plugin-dialog"); - const picked = await open({ multiple: false, directory: false, filters: FILTERS() }); + const picked = await openDialog({ multiple: false, directory: false, filters: FILTERS() }); if (typeof picked !== "string" || useHeap.getState().opening) return; const path = ipcPath(picked); const name = basename(path); @@ -85,8 +85,7 @@ export async function openHeapDump(): Promise { export async function saveHeapDump(id: number): Promise { const entry = useHeap.getState().snapshots[id]; if (!entry || entry.info.origin.kind !== "captured" || isRemoteWindow()) return; - const { save } = await import("@tauri-apps/plugin-dialog"); - const picked = await save({ + const picked = await saveDialog({ defaultPath: `${entry.info.label.replace(/[/\\:*?"<>|]/g, "-")}.hprof`, filters: FILTERS(), }); diff --git a/src/platform/dialog.test.ts b/src/platform/dialog.test.ts index b4162fdbc..e363e45a9 100644 --- a/src/platform/dialog.test.ts +++ b/src/platform/dialog.test.ts @@ -9,7 +9,7 @@ it("opens every file picker through the platform wrapper", () => { (file) => /\.[jt]sx?$/.test(file) && !/\.test\.[jt]sx?$/.test(file) && - file !== "platform/dialog.ts" && + file.replace(/\\/g, "/") !== "platform/dialog.ts" && readFileSync(resolve(src, file), "utf8").includes("@tauri-apps/plugin-" + "dialog"), ); expect(offenders).toEqual([]);