Fix a number of hints and lints (dart-lang/yaml_edit#151)
diff --git a/pkgs/yaml_edit/lib/src/equality.dart b/pkgs/yaml_edit/lib/src/equality.dart index 695a775..36b118e 100644 --- a/pkgs/yaml_edit/lib/src/equality.dart +++ b/pkgs/yaml_edit/lib/src/equality.dart
@@ -44,8 +44,8 @@ bool listDeepEquals(List list1, List list2) { if (list1.length != list2.length) return false; - if (list1 is YamlList) list1 = (list1 as YamlList).nodes; - if (list2 is YamlList) list2 = (list2 as YamlList).nodes; + if (list1 is YamlList) list1 = list1.nodes; + if (list2 is YamlList) list2 = list2.nodes; for (var i = 0; i < list1.length; i++) { if (!deepEquals(list1[i], list2[i])) {
diff --git a/pkgs/yaml_edit/test/random_test.dart b/pkgs/yaml_edit/test/random_test.dart index 2b5af99..f867fe6 100644 --- a/pkgs/yaml_edit/test/random_test.dart +++ b/pkgs/yaml_edit/test/random_test.dart
@@ -253,9 +253,9 @@ $path Error Details: -${error} +$error -${stacktrace} +$stacktrace '''); rethrow; }
diff --git a/pkgs/yaml_edit/test/test_case.dart b/pkgs/yaml_edit/test/test_case.dart index aa80d9e..8db7dbc 100644 --- a/pkgs/yaml_edit/test/test_case.dart +++ b/pkgs/yaml_edit/test/test_case.dart
@@ -232,10 +232,6 @@ return node.value; } -List<T> _onlyType<T>(List<dynamic> rawPath) { - return rawPath.whereType<T>().toList(); -} - /// Converts the list of modifications from the raw input to [_YamlModification] /// objects. List<_YamlModification> _parseModifications(List<dynamic> modifications) {
diff --git a/pkgs/yaml_edit/test/wrap_test.dart b/pkgs/yaml_edit/test/wrap_test.dart index 6d2b24e..d607ed0 100644 --- a/pkgs/yaml_edit/test/wrap_test.dart +++ b/pkgs/yaml_edit/test/wrap_test.dart
@@ -101,8 +101,8 @@ 'value' ])); expect((list as YamlList).style, equals(CollectionStyle.ANY)); - expect((list as YamlList)[0].style, equals(CollectionStyle.ANY)); - expect((list as YamlList)[1].style, equals(CollectionStyle.ANY)); + expect(list[0].style, equals(CollectionStyle.ANY)); + expect(list[1].style, equals(CollectionStyle.ANY)); }); test('wraps lists with collectionStyle', () { @@ -116,8 +116,8 @@ ], collectionStyle: CollectionStyle.BLOCK); expect((list as YamlList).style, equals(CollectionStyle.BLOCK)); - expect((list as YamlList)[0].style, equals(CollectionStyle.ANY)); - expect((list as YamlList)[1].style, equals(CollectionStyle.ANY)); + expect(list[0].style, equals(CollectionStyle.ANY)); + expect(list[1].style, equals(CollectionStyle.ANY)); }); test('wraps nested lists while preserving style', () { @@ -131,8 +131,8 @@ ], collectionStyle: CollectionStyle.BLOCK); expect((list as YamlList).style, equals(CollectionStyle.BLOCK)); - expect((list as YamlList)[0].style, equals(CollectionStyle.FLOW)); - expect((list as YamlList)[1].style, equals(CollectionStyle.FLOW)); + expect(list[0].style, equals(CollectionStyle.FLOW)); + expect(list[1].style, equals(CollectionStyle.FLOW)); }); test('wraps maps', () { @@ -184,8 +184,8 @@ }, collectionStyle: CollectionStyle.BLOCK); expect((map as YamlMap).style, equals(CollectionStyle.BLOCK)); - expect((map as YamlMap)['list'].style, equals(CollectionStyle.FLOW)); - expect((map as YamlMap)['map'].style, equals(CollectionStyle.BLOCK)); + expect(map['list'].style, equals(CollectionStyle.FLOW)); + expect(map['map'].style, equals(CollectionStyle.BLOCK)); }); test('works with YamlMap.wrap', () { @@ -199,8 +199,8 @@ }, collectionStyle: CollectionStyle.BLOCK); expect((map as YamlMap).style, equals(CollectionStyle.BLOCK)); - expect((map as YamlMap)['list'].style, equals(CollectionStyle.FLOW)); - expect((map as YamlMap)['map'].style, equals(CollectionStyle.ANY)); + expect(map['list'].style, equals(CollectionStyle.FLOW)); + expect(map['map'].style, equals(CollectionStyle.ANY)); }); });