Skip to content

chore: remove an unused import and a command attribute nothing could reach - #575

Merged
PathGao merged 1 commit into
masterfrom
chore/dead-code-sweep
Aug 10, 2026
Merged

chore: remove an unused import and a command attribute nothing could reach#575
PathGao merged 1 commit into
masterfrom
chore/dead-code-sweep

Conversation

@PathGao

@PathGao PathGao commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Two dead things, one of which was lying rather than merely unused. Also the first pull request that can read the cargo caches #574 seeded, so the numbers below are worth watching.

State

Unused in lib.rs for long enough that a doc comment refers to it in the past tense. It was the only warning cargo check produced; the build is now clean.

convert_markdown claimed to be a Tauri command

It carried #[tauri::command] while never appearing in generate_handler!.

The function is not dead — it is the renderer that render_markdown and build_markdown_preview call underneath. What was dead was the attribute: no invoke could ever have reached it, and nothing would have said so. A command name is a string with no compiler behind it in either direction, so an attribute claiming an exposure the app does not have compiles happily and reads as live code forever.

So the attribute goes, and a test holds both directions of the list instead:

51 declared #[tauri::command]
50 in generate_handler!
 1 that did not match ← the reason this was found at all

It was found by reading the two lists side by side, which is exactly the work a test should be doing rather than a person.

Swept and deliberately left alone

19 exported types in src/lib that no other file imports — TocSide, PdfExportContext, HeadingReference and so on. Every one is used inside its own file, so they are over-exported rather than dead. Removing export from a type that is already correct is churn with review cost and no benefit.

No other Rust warnings across --all-targets, and no unregistered commands beyond the one above.

Verification

cargo check --all-targets clean, zero warnings
npm test 967 pass
npm run check 677 files, 0 errors
mutation: restore the attribute first assertion fails, second passes

Incidentally: the cache measurement

#574 seeded four cargo caches on master (4.45 GB of a 10 GB budget) with a cold run that took Linux 12m49s, Windows 16m03s, macOS 17m30s. This is the first pull request that can restore them.

The comparison to make is against 12m14s — the Linux baseline #572 was written from, and the number that had not moved at all before this. #574 says so explicitly: if it has not moved meaningfully now, the honest response is to revert the caching rather than keep it as decoration.

🤖 Generated with Claude Code

…reach

Two dead things, one of which was lying rather than merely unused.

`State` had not been imported for anything in lib.rs for long enough that a
doc comment refers to it in the past tense. It was the only warning
`cargo check` produced; the build is now clean.

`convert_markdown` carried `#[tauri::command]` while never appearing in
`generate_handler!`. The function is not dead -- it is the renderer
`render_markdown` and `build_markdown_preview` call underneath -- but the
attribute claimed an exposure the app does not have. No `invoke` could ever
have reached it, and nothing would have said so: a command name is a string
with no compiler behind it in either direction.

So the attribute goes, and scripts/tauriCommandRegistration.test.ts holds
both directions of the list instead. 51 declared, 50 registered, and the one
that did not match is the reason this was found at all -- by reading the two
lists side by side, which is exactly the work a test should be doing.

Also swept, and deliberately left alone: 19 exported types in src/lib that
no other file imports. Every one is used inside its own file, so they are
over-exported rather than dead, and removing `export` from a type that is
already correct is churn with review cost and no benefit.

cargo check clean, 967 tests pass, svelte-check clean. Both assertions
mutation-checked: restoring the attribute fails the first and not the second.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@PathGao
PathGao merged commit 3050ba8 into master Aug 10, 2026
4 checks passed
@PathGao
PathGao deleted the chore/dead-code-sweep branch August 10, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant