Skip to content

Commit 6386dc6

Browse files
gnpricechrisbobbe
authored andcommitted
lint: Enable unnecessary_statements
I was just rereading a draft commit I'd written a little while ago, and realized it had the following code: bool updated = false; updated |= _handleUpdateMessageEventTimestamp(event); updated |= _handleUpdateMessageEventContent(event); updated != _handleUpdateMessageEventMove(event); if (!updated) return; Do you see the bug? . . . There's two different operators there after "updated". They differ by about three or four pixels. Only one of them makes any sense to use in this context, as the top-level expression of an expression statement. When I first reread the diff, I thought I was seeing a speck of dust on my monitor breaking up the last `|`. Fortunately there is a lint rule that would catch this. I don't know why it's not in the recommended lists from the Dart or Flutter teams; but it currently makes zero complaints in our codebase. So enable it.
1 parent 8e934c2 commit 6386dc6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ linter:
2323
rules:
2424
no_literal_bool_comparisons: true
2525
prefer_relative_imports: true
26+
unnecessary_statements: true

0 commit comments

Comments
 (0)