Remove assigned-but-never-read fields and unused catch variable#44
Open
anagnorisis2peripeteia wants to merge 1 commit into
Open
Conversation
…riable Mouse.currentToggleGyroMouse/currentToggleGyroStick are written in ResetToggleGyroModes but never read anywhere; remove the fields and their writes. Also drop the unused exception variable in ScpUtil's Profiles.xml load catch (CS0168). 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 three analyzer-flagged dead values that are never read:
Mouse.currentToggleGyroMouse/currentToggleGyroStick(CS0414) — written inResetToggleGyroModes()but never read anywhere. Removed the fields and their two writes.(
currentToggleGyroControls, which is read, is kept.)ScpUtil's Profiles.xml load catch (CS0168):catch (InvalidOperationException e)->catch (InvalidOperationException).No behavior change.
How verified
Unlike removing an unreferenced declaration or an unused
using(where "it compiles" alreadyimplies "safe"), removing an assigned-but-never-read value could silently drop a side effect —
so each was checked by hand first: both gyro fields are only ever assigned
= false(no sideeffect), and dropping an unused catch identifier doesn't change which exception is caught. Then
compiled:
The single test failure (
CheckSettingsRead) is a pre-existing en-GB date-locale snapshotmismatch, identical on untouched
upstream/main.Scope
Deliberately limited to values whose removal is provably side-effect-free. Two further
assigned-never-read candidates —
ControlService.useRumble(duplicate near-identical codeblocks) and
DS4Device.outputPendCount(private base field vs subclass shadowing) — are heldback for a traced follow-up rather than a mechanical removal.
Authored with Claude (Opus 4.8).
Review history: https://gist.github.com/00b6e96ba78cc14bc88376b161925ded