Remove unreferenced private members#39
Open
anagnorisis2peripeteia wants to merge 1 commit into
Open
Conversation
Roslyn analyzers (IDE0051/CS0169) flag 53 private members as never referenced anywhere in the compilation. Remove them: the unused pass-through getters in DS4StateExposed, dead named constants across the device classes, and orphaned private helper methods. Pure deletion, no behavior change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #38 (dead-code audit).
What
Remove 53 unreferenced private members flagged by the Roslyn analyzers (
IDE0051"unusedprivate member" plus the
CS0169/CS0414field diagnostics) — members with zero referencesanywhere in the compilation:
DS4StateExposed: 27 implicitly-private pass-through property getters(
bool Square { get { return _state.Square; } }…) — an abandoned partial "expose state"surface. The public API (
Motion, etc.) is untouched.JoyConDevice,SwitchProDevice): dead named constants and an emptyRunBluetoothSetup()stub.Mapping.TValue/IfAxisIsNotModified/ one deadEndMacrooverload,
ScpUtil.applyRatio(Color overload) /ClampInt/GetGyroOutModeString/…Type,Mouse.AddEmptyTrackballEntry,CurrentOutDeviceViewModel.DetermineDesired*,RecordBox.RevertListItemTemplate, and a few dead fields/constants (tempBusThread,macroEndIndex,prevBattery,DBT_DEVNODES_CHANGED, …).Pure deletion — no behavior change.
Why
These are demonstrably dead:
privatescope makes the whole reference set the compilationitself, and the analyzers report zero references. Removing them trims analyzer noise and dead
weight from the tree.
How verified
EnforceCodeStyleInBuild=true) over the full project.dotnet publishboth succeed with zero compile errors — awrongly-removed member would fail to compile. Each removal was additionally cross-checked
against call sites (a name collision with a live
Mapping.ClampIntin a different class wascaught, and that method was kept).
DS4WindowsTests11/12 pass — identical to untouchedupstream/main. The singlefailure (
CheckSettingsRead) is a pre-existing date-locale snapshot mismatch (Expected05/12vs Actual12/05), verified to fail identically on the unmodified baseline.Build/test evidence (captured, branch
f321b56, .NET 8 SDK 10.0.301, Windows)The single test failure (
CheckSettingsRead) fails identically on untouchedupstream/main(ba4bdcb):Expected:<05/12/2023 00:24:15>vsActual:<12/05/2023 00:24:15>— a pre-existing en-GB date-locale snapshot mismatch, not introduced here.For a pure-deletion change, "behavior unchanged" is the deliverable, and the clean
dual-platform compile + baseline-identical test result is the proof of it.
Scope
Deliberately limited to whole-declaration removals of unreferenced private members. Held
back for separate follow-ups: fields that are assigned-but-never-read (those need call-site
edits), and two members whose "unused" status looks like a latent wiring bug rather than cruft
(a commented-out auto-profile event subscription and an uncalled exclusive-mode failure
warning) — those are being raised separately rather than silently deleted.
Authored with Claude (Opus 4.8).