Remove outdated ignores (#162773)

Powered by the new and amazing `unnecessary_ignore` lint.

We're not enabling this lint by default because being able to
temporarily use ignores that don't ignore anything is a powerful tool to
enable migrations. We should turn this lint on locally periodically,
though, and clean up all outdated ignores.
This commit is contained in:
Michael Goderbauer
2025-02-06 10:40:25 -08:00
committed by GitHub
parent 5944d992ac
commit c783ce2344
60 changed files with 39 additions and 147 deletions

View File

@@ -326,7 +326,6 @@ class ErrorHandlingFile extends ForwardingFileSystemEntity<File, io.File> with F
bytes += chunkLength;
}
} catch (err) {
// ignore: avoid_catches_without_on_clauses, rethrows
ErrorHandlingFileSystem.deleteIfExists(resultFile, recursive: true);
rethrow;
} finally {

View File

@@ -667,7 +667,6 @@ Future<int> exitWithHooks(int code, {required ShutdownHooks shutdownHooks}) asyn
// This catches all exceptions because the error is propagated on the
// completer.
} catch (error, stackTrace) {
// ignore: avoid_catches_without_on_clauses
completer.completeError(error, stackTrace);
}
});

View File

@@ -89,7 +89,6 @@ class _TaskQueueItem<T> {
try {
_completer.complete(await _closure());
} catch (e) {
// ignore: avoid_catches_without_on_clauses, forwards to Future
_completer.completeError(e);
} finally {
onComplete?.call();

View File

@@ -629,7 +629,6 @@ class ReleaseIosApplicationBundle extends _IosAssetBundleWithDSYM {
try {
await super.build(environment);
} catch (_) {
// ignore: avoid_catches_without_on_clauses
buildSuccess = false;
rethrow;
} finally {

View File

@@ -706,7 +706,6 @@ class ReleaseMacOSBundleFlutterAssets extends MacOSBundleFlutterAssets {
try {
await super.build(environment);
} catch (_) {
// ignore: avoid_catches_without_on_clauses
buildSuccess = false;
rethrow;
} finally {

View File

@@ -357,7 +357,6 @@ class PackagesGetCommand extends FlutterCommand {
);
// Not limiting to catching Exception because the exception is rethrown.
} catch (_) {
// ignore: avoid_catches_without_on_clauses
final Duration elapsedDuration = timer.elapsed;
analytics.send(
Event.timing(

View File

@@ -629,7 +629,6 @@ class UpdatePackagesCommand extends FlutterCommand {
status.stop();
// The exception is rethrown, so don't catch only Exceptions.
} catch (exception) {
// ignore: avoid_catches_without_on_clauses
status.cancel();
rethrow;
}

View File

@@ -664,7 +664,6 @@ void _validateFlutter(YamlMap? yaml, List<String> errors) {
for (int i = 0; i < yamlList.length; i++) {
if (yamlList[i] is! T) {
// ignore: avoid_dynamic_calls
errors.add(
'Expected $context to be a list of $typeAlias, but element at index $i was a ${yamlList[i].runtimeType}.',
);
@@ -682,7 +681,6 @@ void _validateDeferredComponents(MapEntry<Object?, Object?> kvp, List<String> er
for (int i = 0; i < yamlList.length; i++) {
final Object? valueMap = yamlList[i];
if (valueMap is! YamlMap) {
// ignore: avoid_dynamic_calls
errors.add(
'Expected the $i element in "${kvp.key}" to be a map, but got ${yamlList[i]} (${yamlList[i].runtimeType}).',
);

View File

@@ -1799,7 +1799,6 @@ class TerminalHandler {
await _commonTerminalInputHandler(command);
// Catch all exception since this is doing cleanup and rethrowing.
} catch (error, st) {
// ignore: avoid_catches_without_on_clauses
// Don't print stack traces for known error types.
if (error is! ToolExit) {
_logger.printError('$error\n$st');

View File

@@ -258,7 +258,6 @@ class HotRunner extends ResidentRunner {
);
// Catches all exceptions, non-Exception objects are rethrown.
} catch (error) {
// ignore: avoid_catches_without_on_clauses
if (error is! Exception && error is! String) {
rethrow;
}

View File

@@ -991,7 +991,6 @@ class BrowserManager {
return await controller.suite;
// Not limiting to catching Exception because the exception is rethrown.
} catch (_) {
// ignore: avoid_catches_without_on_clauses
closeIframe();
rethrow;
}

View File

@@ -98,7 +98,6 @@ class Tracing {
}
// The exception is rethrown, so don't catch only Exceptions.
} catch (exception) {
// ignore: avoid_catches_without_on_clauses
status.cancel();
rethrow;
}