Implementing control flow collections (#146601)
This pull request aims for improved readability, based on issue #146600. ```dart // before Set<Color> _distinctVisibleColors() { final Set<Color> distinctVisibleColors = <Color>{}; if (top.style != BorderStyle.none) { distinctVisibleColors.add(top.color); } if (right.style != BorderStyle.none) { distinctVisibleColors.add(right.color); } if (bottom.style != BorderStyle.none) { distinctVisibleColors.add(bottom.color); } if (left.style != BorderStyle.none) { distinctVisibleColors.add(left.color); } return distinctVisibleColors; } // after Set<Color> _distinctVisibleColors() { return <Color>{ if (top.style != BorderStyle.none) top.color, if (right.style != BorderStyle.none) right.color, if (bottom.style != BorderStyle.none) bottom.color, if (left.style != BorderStyle.none) left.color, }; } ``` Most of the repo should be covered in this PR (aside from `flutter_tools/`, since there was a lot going on in there).
This commit is contained in:
@@ -110,12 +110,10 @@ class NextContext extends Context {
|
||||
break;
|
||||
}
|
||||
|
||||
final List<pb.Cherrypick> unappliedCherrypicks = <pb.Cherrypick>[];
|
||||
for (final pb.Cherrypick cherrypick in state.engine.cherrypicks) {
|
||||
if (!finishedStates.contains(cherrypick.state)) {
|
||||
unappliedCherrypicks.add(cherrypick);
|
||||
}
|
||||
}
|
||||
final List<pb.Cherrypick> unappliedCherrypicks = <pb.Cherrypick>[
|
||||
for (final pb.Cherrypick cherrypick in state.engine.cherrypicks)
|
||||
if (!finishedStates.contains(cherrypick.state)) cherrypick,
|
||||
];
|
||||
|
||||
if (unappliedCherrypicks.isEmpty) {
|
||||
stdio.printStatus('All engine cherrypicks have been auto-applied by the conductor.\n');
|
||||
@@ -206,12 +204,10 @@ class NextContext extends Context {
|
||||
);
|
||||
}
|
||||
|
||||
final List<pb.Cherrypick> unappliedCherrypicks = <pb.Cherrypick>[];
|
||||
for (final pb.Cherrypick cherrypick in state.framework.cherrypicks) {
|
||||
if (!finishedStates.contains(cherrypick.state)) {
|
||||
unappliedCherrypicks.add(cherrypick);
|
||||
}
|
||||
}
|
||||
final List<pb.Cherrypick> unappliedCherrypicks = <pb.Cherrypick>[
|
||||
for (final pb.Cherrypick cherrypick in state.framework.cherrypicks)
|
||||
if (!finishedStates.contains(cherrypick.state)) cherrypick,
|
||||
];
|
||||
|
||||
if (state.framework.cherrypicks.isEmpty) {
|
||||
stdio.printStatus(
|
||||
|
||||
@@ -183,15 +183,11 @@ abstract class Repository {
|
||||
workingDirectory: (await checkoutDirectory).path,
|
||||
);
|
||||
|
||||
final List<String> remoteBranches = <String>[];
|
||||
for (final String line in output.split('\n')) {
|
||||
final RegExpMatch? match = _lsRemotePattern.firstMatch(line);
|
||||
if (match != null) {
|
||||
remoteBranches.add(match.group(1)!);
|
||||
}
|
||||
}
|
||||
|
||||
return remoteBranches;
|
||||
return <String>[
|
||||
for (final String line in output.split('\n'))
|
||||
if (_lsRemotePattern.firstMatch(line) case final RegExpMatch match)
|
||||
match.group(1)!,
|
||||
];
|
||||
}
|
||||
|
||||
/// Ensure the repository is cloned to disk and initialized with proper state.
|
||||
|
||||
Reference in New Issue
Block a user