linter: enforce unnecessary_async
Change-Id: If5d025ccf2d1a6d80256579bee7a7b3a4d039dde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429061
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
diff --git a/pkg/linter/analysis_options.yaml b/pkg/linter/analysis_options.yaml
index 01918d6..ee6aa8a 100644
--- a/pkg/linter/analysis_options.yaml
+++ b/pkg/linter/analysis_options.yaml
@@ -48,6 +48,7 @@
- test_types_in_equals
- throw_in_finally
- unawaited_futures # pedantic
+ - unnecessary_async
- unnecessary_breaks
- unnecessary_final
- unnecessary_ignore
diff --git a/pkg/linter/test/rule_test_support.dart b/pkg/linter/test/rule_test_support.dart
index 735fae1..663b2b8 100644
--- a/pkg/linter/test/rule_test_support.dart
+++ b/pkg/linter/test/rule_test_support.dart
@@ -264,11 +264,11 @@
}
/// Asserts that there are no diagnostics in the given [content].
- Future<void> assertNoDiagnostics(String content) async =>
+ Future<void> assertNoDiagnostics(String content) =>
assertDiagnostics(content, const []);
/// Asserts that there are no diagnostics in the file at the given [path].
- Future<void> assertNoDiagnosticsInFile(String path) async =>
+ Future<void> assertNoDiagnosticsInFile(String path) =>
assertDiagnosticsInFile(path, const []);
/// Asserts that no diagnostics are reported when resolving [content].
diff --git a/pkg/linter/test/validate_incompatible_rules_test.dart b/pkg/linter/test/validate_incompatible_rules_test.dart
index 074a71c..7cace0c 100644
--- a/pkg/linter/test/validate_incompatible_rules_test.dart
+++ b/pkg/linter/test/validate_incompatible_rules_test.dart
@@ -11,7 +11,7 @@
registerLintRules();
for (var rule in Registry.ruleRegistry) {
for (var incompatibleRule in rule.incompatibleRules) {
- test(rule.name, () async {
+ test(rule.name, () {
var referencedRule = Registry.ruleRegistry.firstWhere(
(r) => r.name == incompatibleRule,
);
diff --git a/pkg/linter/test/validate_no_rule_description_references_test.dart b/pkg/linter/test/validate_no_rule_description_references_test.dart
index 83b5e21..b1bf1f3 100644
--- a/pkg/linter/test/validate_no_rule_description_references_test.dart
+++ b/pkg/linter/test/validate_no_rule_description_references_test.dart
@@ -16,7 +16,7 @@
() {
registerLintRules();
for (var rule in Registry.ruleRegistry) {
- test(rule.name, () async {
+ test(rule.name, () {
var result = Process.runSync('grep', [
'-R',
rule.description,
diff --git a/pkg/linter/test/verify_reflective_test_suites_test.dart b/pkg/linter/test/verify_reflective_test_suites_test.dart
index c745bd6..13de91e 100644
--- a/pkg/linter/test/verify_reflective_test_suites_test.dart
+++ b/pkg/linter/test/verify_reflective_test_suites_test.dart
@@ -79,7 +79,7 @@
}
}
var relativePath = path.relative(directory.path, from: testDirPath);
- test(relativePath, () async {
+ test(relativePath, () {
if (testFileNames.isEmpty) return;
if (testAllFile == null) return;