Skip to content

Commit 679b6f8

Browse files
refactor: use return with switch expression
1 parent 9de7a17 commit 679b6f8

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎lib/src/lints/prefer_last/visitors/prefer_last_visitor.dart‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,18 @@ class PreferLastVisitor extends RecursiveAstVisitor<void> {
9595
}
9696

9797
Expression _unwrapExpression(Expression expression) {
98-
switch (expression) {
99-
case PostfixExpression(
98+
return switch (expression) {
99+
PostfixExpression(
100100
:final operand,
101101
operator: Token(type: TokenType.BANG),
102-
):
103-
return _unwrapExpression(operand);
102+
) =>
103+
_unwrapExpression(operand),
104104

105-
case ParenthesizedExpression(:final expression):
106-
return _unwrapExpression(expression);
105+
ParenthesizedExpression(:final expression) => _unwrapExpression(
106+
expression,
107+
),
107108

108-
default:
109-
return expression;
110-
}
109+
_ => expression,
110+
};
111111
}
112112
}

0 commit comments

Comments
 (0)