Skip to content

proposal: avoid_unnecessary_return #58913

@fzyzcjy

Description

@fzyzcjy

<lint_name>

avoid_unnecessary_return

Description

As mentioned in flutter/flutter#114290 (comment), it would be great to have a linter to catch:

void f() {
  ...
  return; // LINT this is unnecessary!
}

Realworld example: flutter/flutter#114290

Details

see above

Kind

style?

Good Examples

see above

Bad Examples

see above

Discussion

Add any other motivation or useful context here.

Discussion checklist

  • List any existing rules this proposal modifies, complements, overlaps or conflicts with.
  • List any relevant issues (reported here, the SDK Tracker, or elsewhere).
  • If there's any prior art (e.g., in other linters), please add references here.
  • If this proposal corresponds to Effective Dart or Flutter Style Guide advice, please call it out. (If there isn't any corresponding advice, should there be?)
  • If this proposal is motivated by real-world examples, please provide as many details as you can. Demonstrating potential impact is especially valuable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-status-pendingtype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions