Remove new keyword from code samples (#116)
Find the word `new` where it is use in a context referencing Dart code
and remove it to match the style of Dart we write.
Change a `[]` in an implementation comment to backticks since `[]`
should be use in Doc comments and does not have meaning in other
comments.
diff --git a/lib/src/equality.dart b/lib/src/equality.dart
index 3e99ada..b003a06 100644
--- a/lib/src/equality.dart
+++ b/lib/src/equality.dart
@@ -41,7 +41,7 @@
///
/// The following [Equality] considers employees with the same IDs to be equal:
/// ```dart
-/// new EqualityBy((Employee e) => e.employmentId);
+/// EqualityBy((Employee e) => e.employmentId);
/// ```
///
/// It's also possible to pass an additional equality instance that should be
diff --git a/lib/src/union_set_controller.dart b/lib/src/union_set_controller.dart
index b184530..6c04cef 100644
--- a/lib/src/union_set_controller.dart
+++ b/lib/src/union_set_controller.dart
@@ -12,7 +12,7 @@
/// ```dart
/// class Engine {
/// Set<Test> get activeTests => _activeTestsGroup.set;
-/// final _activeTestsGroup = new UnionSetController<Test>();
+/// final _activeTestsGroup = UnionSetController<Test>();
///
/// void addSuite(Suite suite) {
/// _activeTestsGroup.add(suite.tests);
diff --git a/lib/src/unmodifiable_wrappers.dart b/lib/src/unmodifiable_wrappers.dart
index ebac05f..7a7898e 100644
--- a/lib/src/unmodifiable_wrappers.dart
+++ b/lib/src/unmodifiable_wrappers.dart
@@ -109,7 +109,7 @@
/// An unmodifiable empty set.
///
- /// This is the same as `new UnmodifiableSetView(new Set())`, except that it
+ /// This is the same as `UnmodifiableSetView(Set())`, except that it
/// can be used in const contexts.
const factory UnmodifiableSetView.empty() = EmptyUnmodifiableSet<E>;
}
diff --git a/test/priority_queue_test.dart b/test/priority_queue_test.dart
index 03e2253..928de6c 100644
--- a/test/priority_queue_test.dart
+++ b/test/priority_queue_test.dart
@@ -15,7 +15,7 @@
}
void testDefault() {
- test('new PriorityQueue() returns a HeapPriorityQueue', () {
+ test('PriorityQueue() returns a HeapPriorityQueue', () {
expect(PriorityQueue<int>(), TypeMatcher<HeapPriorityQueue<int>>());
});
testInt(() => PriorityQueue<int>());
diff --git a/test/queue_list_test.dart b/test/queue_list_test.dart
index 4099308..d37cc61 100644
--- a/test/queue_list_test.dart
+++ b/test/queue_list_test.dart
@@ -8,7 +8,7 @@
import 'utils.dart';
void main() {
- group('new QueueList()', () {
+ group('QueueList()', () {
test('creates an empty QueueList', () {
expect(QueueList(), isEmpty);
});
@@ -18,7 +18,7 @@
});
});
- test('new QueueList.from() copies the contents of an iterable', () {
+ test('QueueList.from() copies the contents of an iterable', () {
expect(QueueList.from([1, 2, 3].skip(1)), equals([2, 3]));
});
@@ -298,7 +298,7 @@
/// Returns a queue whose internal ring buffer is full enough that adding a new
/// element will expand it.
QueueList atCapacity() {
- // Use addAll because [new QueueList.from(List)] won't use the default initial
+ // Use addAll because `QueueList.from(list)` won't use the default initial
// capacity of 8.
return QueueList()..addAll([1, 2, 3, 4, 5, 6, 7]);
}