flutter_tools: Remove unused parameters#185347
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request removes the onComplete parameter from the _TaskQueueItem constructor in task_queue.dart. The review feedback suggests removing the corresponding onComplete field to avoid dead code and potential compilation errors, consistent with the repository's style guide to only include necessary code.
|
|
||
| class _TaskQueueItem<T> { | ||
| _TaskQueueItem(this._closure, this._completer, {this.onComplete}); | ||
| _TaskQueueItem(this._closure, this._completer); |
There was a problem hiding this comment.
The onComplete field in _TaskQueueItem appears to be unused now that the constructor parameter has been removed. Since this.onComplete was used in the constructor, there must be a corresponding field in the class. If this field is no longer needed, it should be removed along with any code that references it to avoid dead code. Additionally, if the field is final, leaving it in the class without an initializer will cause a compilation error.
References
- The style guide advises to 'Write what you need and no more'. Leaving an unused field after removing its constructor parameter violates this principle of avoiding dead code. (link)
Work towards dart-lang/sdk#47839
The lint rule will start reporting these unused parameters. These are parameters for which no arguments are ever given, so they are dead code.