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

Remove some unused locals #9573

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Conversation

drewnoakes
Copy link
Member

@drewnoakes drewnoakes commented Oct 29, 2024

Following a recent PR that improved performance by removing the initialization of a value assigned to an unused variable, I wanted to enable more analyzers to prevent this in future.

Unfortunately there's not an analyzer that'll catch all instances of this. Within VS we have IDE0059 already, and this PR turns it into an error (rather than a hint) but it won't catch everything.

The things it did flag are fixed here.

Microsoft Reviewers: Open in CodeFlow

@drewnoakes drewnoakes requested a review from a team as a code owner October 29, 2024 01:32
@@ -67,7 +67,6 @@ internal async Task<List<ProjectSystemReferenceInfo>> GetReferencesAsync(Configu

private static async Task<bool> GetAttributeTreatAsUsedAsync(IProjectProperties metadata)
{
var propertyNames = await metadata.GetPropertyNamesAsync();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change here that has an impact at runtime.

@drewnoakes drewnoakes closed this Oct 29, 2024
@drewnoakes drewnoakes reopened this Oct 29, 2024
Following a recent PR that improved performance by removing the initialization of a value assigned to an unused variable, I wanted to enable more analyzers to prevent this in future.

Unfortunately there's not an analyzer that'll catch all instances of this. Within VS we have `IDE0059` already, and this PR turns it into an error (rather than a hint) but it won't catch everything.

The things it did flag are fixed here.
@drewnoakes drewnoakes force-pushed the remove-unused-locals branch from 802c0c9 to e1f18e9 Compare October 29, 2024 11:02
@drewnoakes drewnoakes merged commit 4e56ee4 into dotnet:main Nov 5, 2024
5 checks passed
@drewnoakes drewnoakes deleted the remove-unused-locals branch November 5, 2024 20:01
@dotnet-policy-service dotnet-policy-service bot added this to the 17.12 milestone Nov 5, 2024
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.

2 participants