Skip to content

Commit c757df3

Browse files
authored
Remove unnecessary null checks in dev/bots (#118846)
1 parent 70cecf6 commit c757df3

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

dev/bots/analyze.dart

-3
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,6 @@ Future<void> verifyDeprecations(String workingDirectory, { int minimumMatches =
597597
}
598598

599599
String _generateLicense(String prefix) {
600-
assert(prefix != null);
601600
return '${prefix}Copyright 2014 The Flutter Authors. All rights reserved.\n'
602601
'${prefix}Use of this source code is governed by a BSD-style license that can be\n'
603602
'${prefix}found in the LICENSE file.';
@@ -1576,8 +1575,6 @@ Future<void> verifyNoBinaries(String workingDirectory, { Set<Hash256>? legacyBin
15761575
// UTILITY FUNCTIONS
15771576

15781577
bool _listEquals<T>(List<T> a, List<T> b) {
1579-
assert(a != null);
1580-
assert(b != null);
15811578
if (a.length != b.length) {
15821579
return false;
15831580
}

dev/bots/analyze_snippet_code.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ class _SnippetChecker {
924924
continue;
925925
}
926926

927-
final _SnippetFile snippet = snippets[file.path]!;
927+
final _SnippetFile? snippet = snippets[file.path];
928928
if (snippet == null) {
929929
errors.add(_SnippetCheckerException(
930930
"Unknown section for ${file.path}. Maybe the temporary directory wasn't empty?",

dev/bots/prepare_package.dart

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ class PreparePackageException implements Exception {
4141
@override
4242
String toString() {
4343
String output = runtimeType.toString();
44-
if (message != null) {
45-
output += ': $message';
46-
}
44+
output += ': $message';
4745
final String stderr = result?.stderr as String? ?? '';
4846
if (stderr.isNotEmpty) {
4947
output += ':\n$stderr';

dev/bots/test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ Future<void> _runFrameworkTests() async {
10181018
printOutput: false,
10191019
outputChecker: (CommandResult result) {
10201020
final Iterable<Match> matches = httpClientWarning.allMatches(result.flattenedStdout!);
1021-
if (matches == null || matches.isEmpty || matches.length > 1) {
1021+
if (matches.isEmpty || matches.length > 1) {
10221022
return 'Failed to print warning about HttpClientUsage, or printed it too many times.\n\n'
10231023
'stdout:\n${result.flattenedStdout}\n\n'
10241024
'stderr:\n${result.flattenedStderr}';

dev/bots/unpublish_package.dart

+3-10
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ class UnpublishException implements Exception {
3737
@override
3838
String toString() {
3939
String output = runtimeType.toString();
40-
if (message != null) {
41-
output += ': $message';
42-
}
40+
output += ': $message';
4341
final String stderr = result?.stderr as String? ?? '';
4442
if (stderr.isNotEmpty) {
4543
output += ':\n$stderr';
@@ -113,9 +111,7 @@ class ProcessRunner {
113111
this.subprocessOutput = true,
114112
this.defaultWorkingDirectory,
115113
this.platform = const LocalPlatform(),
116-
}) : assert(subprocessOutput != null),
117-
assert(processManager != null),
118-
assert(platform != null) {
114+
}) {
119115
environment = Map<String, String>.from(platform.environment);
120116
}
121117

@@ -255,9 +251,6 @@ class ArchiveUnpublisher {
255251
continue;
256252
}
257253
final Map<String, String> replacementRelease = releases.firstWhere((Map<String, String> value) => value['channel'] == getChannelName(channel));
258-
if (replacementRelease == null) {
259-
throw UnpublishException('Unable to find previous release for channel ${getChannelName(channel)}.');
260-
}
261254
(jsonData['current_release'] as Map<String, dynamic>)[getChannelName(channel)] = replacementRelease['hash'];
262255
print(
263256
'${confirmed ? 'Reverting' : 'Would revert'} current ${getChannelName(channel)} '
@@ -468,7 +461,7 @@ Future<void> main(List<String> rawArguments) async {
468461
final String tempDirArg = parsedArguments['temp_dir'] as String;
469462
Directory tempDir;
470463
bool removeTempDir = false;
471-
if (tempDirArg == null || tempDirArg.isEmpty) {
464+
if (tempDirArg.isEmpty) {
472465
tempDir = Directory.systemTemp.createTempSync('flutter_package.');
473466
removeTempDir = true;
474467
} else {

0 commit comments

Comments
 (0)