Skip to content

Remove unused using directives#40

Open
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:cleanup/remove-unused-usings
Open

Remove unused using directives#40
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:cleanup/remove-unused-usings

Conversation

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor

Part of #38 (dead-code audit).

What

Remove 158 unused using directives across 96 files in DS4WinWPF, flagged by the IDE0005
analyzer during a full-reference build. Pure removal — no code changes.

Why the extra care (WPF makes this non-trivial)

Unused-using detection is unreliable on this project via the obvious route: dotnet format's
IDE0005 pass runs in a Roslyn workspace that doesn't fully resolve the project's package
references (ViGEm / FakerInput / OSC), so it falsely flags live usings as unused (e.g.
Nefarius.ViGEm.Client) and would break the build.

So this PR removes only the usings flagged by IDE0005 during a real, full-reference
dotnet build (EnforceCodeStyleInBuild=true), and then verifies every removal by
compiling
— no removal is trusted until the compiler proves it unnecessary.

How verified

All four shipping configurations compile with zero errors (a using needed only by an
#if WIN64 (x86) or #if DEBUG branch would fail one of these):

x64 Release publish : REL_X64_EXIT=0
x86 Release publish : REL_X86_EXIT=0
x64 Debug build     : DBG_X64_EXIT=0
x86 Debug build     : DBG_X86_EXIT=0
DS4WindowsTests     : Passed 11, Failed 1, Total 12

The single test failure (CheckSettingsRead) is a pre-existing en-GB date-locale snapshot
mismatch (Expected 05/12 vs Actual 12/05), identical on untouched upstream/main — not
introduced here.

Authored with Claude (Opus 4.8).


Review history: https://gist.github.com/81d5826c23e2eb0dfdedaade7421e647

Remove 158 unused using directives flagged by the IDE0005 analyzer
during a full-reference build. Pure removal, no code changes.
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