Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S4487: Unread "private" fields should be removed #1049

Merged
merged 8 commits into from
Nov 29, 2022
Merged

Conversation

bart-vmware
Copy link
Member

@bart-vmware bart-vmware commented Nov 11, 2022

Description

This PR removes private fields that are unused or only assigned but never read.

If during review, you find any cases where the field should not be removed, please indicate how to update existing code to read from the field and use its value.

Fixes #954.

  • Your code complies with our Coding Style.
  • You've updated unit and/or integration tests for your change, where applicable.
  • You've updated documentation for your change, where applicable.
    If your change affects other repositories, such as Documentation, Samples and/or MainSite, add linked PRs here.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.
  • You've added required license files and/or file headers (explaining where the code came from with proper attribution), where code is copied from StackOverflow, a blog, or OSS.

@bart-vmware bart-vmware marked this pull request as ready for review November 14, 2022 08:27
@bart-vmware
Copy link
Member Author

As @hananiel pointed out elsewhere, it may be necessary to keep fields of reference types that aren't read from, just to extend their lifetime and prevent them from being garbage-collected. That's a legitimate case to suppress warnings.

@hananiel hananiel self-assigned this Nov 16, 2022
dtillman
dtillman previously approved these changes Nov 26, 2022
@bart-vmware bart-vmware merged commit 986eee2 into main Nov 29, 2022
@bart-vmware bart-vmware deleted the fix-S4487 branch November 29, 2022 13:57
@TimHess TimHess added this to the 4.0.0-alpha milestone Dec 5, 2022
@bart-vmware bart-vmware mentioned this pull request Dec 14, 2022
5 tasks
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.

Address S4487: Unread "private" fields should be removed
4 participants