-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 unused locals in System.ServiceProcess.ServiceController #31704
Conversation
@@ -474,7 +474,7 @@ private void DeferredPowerEvent(int eventType, IntPtr eventData) | |||
try | |||
{ | |||
PowerBroadcastStatus status = (PowerBroadcastStatus)eventType; | |||
bool statusResult = OnPowerEvent(status); | |||
_ = OnPowerEvent(status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be:
OnPowerEvent((PowerBroadcastStatus)eventType);
@@ -473,8 +473,7 @@ private void DeferredPowerEvent(int eventType, IntPtr eventData) | |||
// already been freed. | |||
try | |||
{ | |||
PowerBroadcastStatus status = (PowerBroadcastStatus)eventType; | |||
_ = OnPowerEvent(status); | |||
_ = OnPowerEvent((PowerBroadcastStatus)eventType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ = OnPowerEvent((PowerBroadcastStatus)eventType); | |
OnPowerEvent((PowerBroadcastStatus)eventType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would you prefer discards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would you prefer discards?
For ignored return values, only if it's critical that someone reading the code understands data is being thrown away, or if the compiler complains. The former might show up in one of our security libraries, for example. The latter might show up with a method returning a Task in an async method and where we explicitly want to ignore it.
Co-Authored-By: Stephen Toub <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Contributes to #30457