Skip to content

Commit

Permalink
Fixes for lints in package:pedantic 1.9.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmorgan committed Dec 6, 2019
1 parent 497de3d commit e796ba9
Show file tree
Hide file tree
Showing 18 changed files with 182 additions and 202 deletions.
40 changes: 20 additions & 20 deletions lib/src/internal/copy_on_write_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'dart:math';

class CopyOnWriteList<E> implements List<E> {
bool _copyBeforeWrite;
bool _growable;
final bool _growable;
List<E> _list;

CopyOnWriteList(this._list, this._growable) : _copyBeforeWrite = true;
Expand All @@ -23,7 +23,7 @@ class CopyOnWriteList<E> implements List<E> {
List<E> operator +(List<E> other) => _list + other;

@override
bool any(bool test(E element)) => _list.any(test);
bool any(bool Function(E) test) => _list.any(test);

@override
Map<int, E> asMap() => _list.asMap();
Expand All @@ -38,27 +38,27 @@ class CopyOnWriteList<E> implements List<E> {
E elementAt(int index) => _list.elementAt(index);

@override
bool every(bool test(E element)) => _list.every(test);
bool every(bool Function(E) test) => _list.every(test);

@override
Iterable<T> expand<T>(Iterable<T> f(E e)) => _list.expand(f);
Iterable<T> expand<T>(Iterable<T> Function(E) f) => _list.expand(f);

@override
E get first => _list.first;

@override
E firstWhere(bool test(E element), {E orElse()}) =>
E firstWhere(bool Function(E) test, {E Function() orElse}) =>
_list.firstWhere(test, orElse: orElse);

@override
T fold<T>(T initialValue, T combine(T previousValue, E element)) =>
T fold<T>(T initialValue, T Function(T, E) combine) =>
_list.fold(initialValue, combine);

@override
Iterable<E> followedBy(Iterable<E> other) => _list.followedBy(other);

@override
void forEach(void f(E element)) => _list.forEach(f);
void forEach(void Function(E) f) => _list.forEach(f);

@override
Iterable<E> getRange(int start, int end) => _list.getRange(start, end);
Expand All @@ -67,7 +67,7 @@ class CopyOnWriteList<E> implements List<E> {
int indexOf(E element, [int start = 0]) => _list.indexOf(element, start);

@override
int indexWhere(bool test(E element), [int start = 0]) =>
int indexWhere(bool Function(E) test, [int start = 0]) =>
_list.indexWhere(test, start);

@override
Expand All @@ -80,7 +80,7 @@ class CopyOnWriteList<E> implements List<E> {
Iterator<E> get iterator => _list.iterator;

@override
String join([String separator = ""]) => _list.join(separator);
String join([String separator = '']) => _list.join(separator);

@override
E get last => _list.last;
Expand All @@ -89,18 +89,18 @@ class CopyOnWriteList<E> implements List<E> {
int lastIndexOf(E element, [int start]) => _list.lastIndexOf(element, start);

@override
int lastIndexWhere(bool test(E element), [int start]) =>
int lastIndexWhere(bool Function(E) test, [int start]) =>
_list.lastIndexWhere(test, start);

@override
E lastWhere(bool test(E element), {E orElse()}) =>
E lastWhere(bool Function(E) test, {E Function() orElse}) =>
_list.lastWhere(test, orElse: orElse);

@override
Iterable<T> map<T>(T f(E e)) => _list.map(f);
Iterable<T> map<T>(T Function(E) f) => _list.map(f);

@override
E reduce(E combine(E value, E element)) => _list.reduce(combine);
E reduce(E Function(E, E) combine) => _list.reduce(combine);

@override
Iterable<E> get reversed => _list.reversed;
Expand All @@ -109,14 +109,14 @@ class CopyOnWriteList<E> implements List<E> {
E get single => _list.single;

@override
E singleWhere(bool test(E element), {E orElse()}) =>
E singleWhere(bool Function(E) test, {E Function() orElse}) =>
_list.singleWhere(test, orElse: orElse);

@override
Iterable<E> skip(int count) => _list.skip(count);

@override
Iterable<E> skipWhile(bool test(E value)) => _list.skipWhile(test);
Iterable<E> skipWhile(bool Function(E) test) => _list.skipWhile(test);

@override
List<E> sublist(int start, [int end]) => _list.sublist(start, end);
Expand All @@ -125,7 +125,7 @@ class CopyOnWriteList<E> implements List<E> {
Iterable<E> take(int count) => _list.take(count);

@override
Iterable<E> takeWhile(bool test(E value)) => _list.takeWhile(test);
Iterable<E> takeWhile(bool Function(E) test) => _list.takeWhile(test);

@override
List<E> toList({bool growable = true}) => _list.toList(growable: growable);
Expand All @@ -134,7 +134,7 @@ class CopyOnWriteList<E> implements List<E> {
Set<E> toSet() => _list.toSet();

@override
Iterable<E> where(bool test(E element)) => _list.where(test);
Iterable<E> where(bool Function(E) test) => _list.where(test);

@override
Iterable<T> whereType<T>() => _list.whereType<T>();
Expand Down Expand Up @@ -178,7 +178,7 @@ class CopyOnWriteList<E> implements List<E> {
}

@override
void sort([int compare(E a, E b)]) {
void sort([int Function(E, E) compare]) {
_maybeCopyBeforeWrite();
_list.sort(compare);
}
Expand Down Expand Up @@ -232,13 +232,13 @@ class CopyOnWriteList<E> implements List<E> {
}

@override
void removeWhere(bool test(E element)) {
void removeWhere(bool Function(E) test) {
_maybeCopyBeforeWrite();
_list.removeWhere(test);
}

@override
void retainWhere(bool test(E element)) {
void retainWhere(bool Function(E) test) {
_maybeCopyBeforeWrite();
_list.retainWhere(test);
}
Expand Down
14 changes: 7 additions & 7 deletions lib/src/internal/copy_on_write_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

typedef Map<K, V> _MapFactory<K, V>();
typedef _MapFactory<K, V> = Map<K, V> Function();

class CopyOnWriteMap<K, V> implements Map<K, V> {
final _MapFactory<K, V> _mapFactory;
Expand All @@ -29,7 +29,7 @@ class CopyOnWriteMap<K, V> implements Map<K, V> {
Iterable<MapEntry<K, V>> get entries => _map.entries;

@override
void forEach(void f(K key, V value)) => _map.forEach(f);
void forEach(void Function(K, V) f) => _map.forEach(f);

@override
bool get isEmpty => _map.isEmpty;
Expand All @@ -44,7 +44,7 @@ class CopyOnWriteMap<K, V> implements Map<K, V> {
int get length => _map.length;

@override
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> f(K key, V value)) => _map.map(f);
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(K, V) f) => _map.map(f);

@override
Iterable<V> get values => _map.values;
Expand Down Expand Up @@ -76,7 +76,7 @@ class CopyOnWriteMap<K, V> implements Map<K, V> {
}

@override
V putIfAbsent(K key, V ifAbsent()) {
V putIfAbsent(K key, V Function() ifAbsent) {
_maybeCopyBeforeWrite();
return _map.putIfAbsent(key, ifAbsent);
}
Expand All @@ -88,7 +88,7 @@ class CopyOnWriteMap<K, V> implements Map<K, V> {
}

@override
void removeWhere(bool test(K key, V value)) {
void removeWhere(bool Function(K, V) test) {
_maybeCopyBeforeWrite();
_map.removeWhere(test);
}
Expand All @@ -97,13 +97,13 @@ class CopyOnWriteMap<K, V> implements Map<K, V> {
String toString() => _map.toString();

@override
V update(K key, V update(V value), {V ifAbsent()}) {
V update(K key, V Function(V) update, {V Function() ifAbsent}) {
_maybeCopyBeforeWrite();
return _map.update(key, update, ifAbsent: ifAbsent);
}

@override
void updateAll(V update(K key, V value)) {
void updateAll(V Function(K, V) update) {
_maybeCopyBeforeWrite();
_map.updateAll(update);
}
Expand Down
34 changes: 17 additions & 17 deletions lib/src/internal/copy_on_write_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

typedef Set<E> _SetFactory<E>();
typedef _SetFactory<E> = Set<E> Function();

class CopyOnWriteSet<E> implements Set<E> {
final _SetFactory<E> _setFactory;
Expand Down Expand Up @@ -32,7 +32,7 @@ class CopyOnWriteSet<E> implements Set<E> {
bool containsAll(Iterable<Object> other) => _set.containsAll(other);

@override
bool any(bool test(E element)) => _set.any(test);
bool any(bool Function(E) test) => _set.any(test);

@override
Set<T> cast<T>() => CopyOnWriteSet<T>(_set.cast<T>());
Expand All @@ -44,27 +44,27 @@ class CopyOnWriteSet<E> implements Set<E> {
E elementAt(int index) => _set.elementAt(index);

@override
bool every(bool test(E element)) => _set.every(test);
bool every(bool Function(E) test) => _set.every(test);

@override
Iterable<T> expand<T>(Iterable<T> f(E e)) => _set.expand(f);
Iterable<T> expand<T>(Iterable<T> Function(E) f) => _set.expand(f);

@override
E get first => _set.first;

@override
E firstWhere(bool test(E element), {E orElse()}) =>
E firstWhere(bool Function(E) test, {E Function() orElse}) =>
_set.firstWhere(test, orElse: orElse);

@override
T fold<T>(T initialValue, T combine(T previousValue, E element)) =>
T fold<T>(T initialValue, T Function(T, E) combine) =>
_set.fold(initialValue, combine);

@override
Iterable<E> followedBy(Iterable<E> other) => _set.followedBy(other);

@override
void forEach(void f(E element)) => _set.forEach(f);
void forEach(void Function(E) f) => _set.forEach(f);

@override
bool get isEmpty => _set.isEmpty;
Expand All @@ -76,39 +76,39 @@ class CopyOnWriteSet<E> implements Set<E> {
Iterator<E> get iterator => _set.iterator;

@override
String join([String separator = ""]) => _set.join(separator);
String join([String separator = '']) => _set.join(separator);

@override
E get last => _set.last;

@override
E lastWhere(bool test(E element), {E orElse()}) =>
E lastWhere(bool Function(E) test, {E Function() orElse}) =>
_set.lastWhere(test, orElse: orElse);

@override
Iterable<T> map<T>(T f(E e)) => _set.map(f);
Iterable<T> map<T>(T Function(E) f) => _set.map(f);

@override
E reduce(E combine(E value, E element)) => _set.reduce(combine);
E reduce(E Function(E, E) combine) => _set.reduce(combine);

@override
E get single => _set.single;

@override
E singleWhere(bool test(E element), {E orElse()}) =>
E singleWhere(bool Function(E) test, {E Function() orElse}) =>
_set.singleWhere(test, orElse: orElse);

@override
Iterable<E> skip(int count) => _set.skip(count);

@override
Iterable<E> skipWhile(bool test(E value)) => _set.skipWhile(test);
Iterable<E> skipWhile(bool Function(E) test) => _set.skipWhile(test);

@override
Iterable<E> take(int count) => _set.take(count);

@override
Iterable<E> takeWhile(bool test(E value)) => _set.takeWhile(test);
Iterable<E> takeWhile(bool Function(E) test) => _set.takeWhile(test);

@override
List<E> toList({bool growable = true}) => _set.toList(growable: growable);
Expand All @@ -117,7 +117,7 @@ class CopyOnWriteSet<E> implements Set<E> {
Set<E> toSet() => _set.toSet();

@override
Iterable<E> where(bool test(E element)) => _set.where(test);
Iterable<E> where(bool Function(E) test) => _set.where(test);

@override
Iterable<T> whereType<T>() => _set.whereType<T>();
Expand Down Expand Up @@ -149,13 +149,13 @@ class CopyOnWriteSet<E> implements Set<E> {
}

@override
void removeWhere(bool test(E element)) {
void removeWhere(bool Function(E) test) {
_maybeCopyBeforeWrite();
_set.removeWhere(test);
}

@override
void retainWhere(bool test(E element)) {
void retainWhere(bool Function(E) test) {
_maybeCopyBeforeWrite();
_set.retainWhere(test);
}
Expand Down
Loading

0 comments on commit e796ba9

Please sign in to comment.