Skip to content

Commit b978085

Browse files
Delete unreachable default clauses. (#8246)
The Dart analyzer will soon be changed so that if the `default` clause of a `switch` statement is determined to be unreachable by the exhaustiveness checker, a new warning of type `unreachable_switch_default` will be issued. This parallels the behavior of the existing `unreachable_switch_case` warning, which is issued whenever a `case` clause of a `switch` statement is determined to be unreachable. For details see dart-lang/sdk#54575. This PR deletes unreachable `default` clauses from `devtools` now, to avoid a spurious warning when the analyzer change lands.
1 parent f5ebeae commit b978085

File tree

8 files changed

+0
-18
lines changed

8 files changed

+0
-18
lines changed

packages/devtools_app/lib/src/screens/app_size/app_size_controller.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ enum DiffTreeType {
3737
case DiffTreeType.decreaseOnly:
3838
return 'Decrease Only';
3939
case DiffTreeType.combined:
40-
default:
4140
return 'Combined';
4241
}
4342
}
@@ -55,7 +54,6 @@ enum AppUnit {
5554
case AppUnit.mainOnly:
5655
return _mainNodeName;
5756
case AppUnit.entireApp:
58-
default:
5957
return _entireAppNodeName;
6058
}
6159
}
@@ -185,7 +183,6 @@ class AppSizeController {
185183
case AppUnit.deferredOnly:
186184
return _deferredDiffTreeMap;
187185
case AppUnit.entireApp:
188-
default:
189186
return _diffTreeMap;
190187
}
191188
}
@@ -205,8 +202,6 @@ class AppSizeController {
205202
return diffMap.decreaseOnly;
206203
case DiffTreeType.combined:
207204
return diffMap.combined;
208-
default:
209-
return diffMap.combined;
210205
}
211206
}
212207

@@ -221,7 +216,6 @@ class AppSizeController {
221216
case AppUnit.mainOnly:
222217
return _mainOnly;
223218
case AppUnit.entireApp:
224-
default:
225219
return _entireApp;
226220
}
227221
}

packages/devtools_app/lib/src/screens/inspector/layout_explorer/flex/utils.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ extension AxisExtension on Axis {
197197
case Axis.horizontal:
198198
return 'Row';
199199
case Axis.vertical:
200-
default:
201200
return 'Column';
202201
}
203202
}

packages/devtools_app/lib/src/screens/inspector_v2/layout_explorer/flex/utils.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ extension AxisExtension on Axis {
197197
case Axis.horizontal:
198198
return 'Row';
199199
case Axis.vertical:
200-
default:
201200
return 'Column';
202201
}
203202
}

packages/devtools_app/lib/src/shared/charts/chart.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,10 +698,6 @@ class ChartPainter extends CustomPainter {
698698
);
699699
canvas.drawPath(path, paintFirst);
700700
break;
701-
default:
702-
final message = 'Unknown symbol ${characteristics.symbol}';
703-
assert(false, message);
704-
_log.shout(message);
705701
}
706702
}
707703

packages/devtools_app/lib/src/shared/charts/treemap.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ class _TreemapState extends State<Treemap> {
123123
}
124124
}
125125
return pivotIndex;
126-
default:
127-
return -1;
128126
}
129127
}
130128

packages/devtools_app/lib/src/shared/primitives/utils.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,6 @@ class TimeRange {
518518
case TimeUnit.microseconds:
519519
return '[${_start?.inMicroseconds} μs - ${end?.inMicroseconds} μs]';
520520
case TimeUnit.milliseconds:
521-
default:
522521
return '[${_start?.inMilliseconds} ms - ${end?.inMilliseconds} ms]';
523522
}
524523
}

packages/devtools_app/lib/src/shared/table/_table_row.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ class _TableRowState<T> extends State<TableRow<T>>
365365
case ColumnAlignment.right:
366366
return Alignment.centerRight;
367367
case ColumnAlignment.left:
368-
default:
369368
return Alignment.centerLeft;
370369
}
371370
}

packages/devtools_app/lib/src/shared/table/table_data.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ extension ColumnDataExtension<T> on ColumnData<T> {
175175
case ColumnAlignment.right:
176176
return MainAxisAlignment.end;
177177
case ColumnAlignment.left:
178-
default:
179178
return MainAxisAlignment.start;
180179
}
181180
}
@@ -187,7 +186,6 @@ extension ColumnDataExtension<T> on ColumnData<T> {
187186
case ColumnAlignment.right:
188187
return TextAlign.right;
189188
case ColumnAlignment.left:
190-
default:
191189
return TextAlign.left;
192190
}
193191
}

0 commit comments

Comments
 (0)