Unnecessary new (#20138)

* enable lint unnecessary_new

* fix tests

* fix tests

* fix tests
This commit is contained in:
Alexandre Ardhuin
2018-09-12 08:29:29 +02:00
committed by GitHub
parent d7a0dcaa4a
commit d927c93310
1285 changed files with 26519 additions and 26519 deletions

View File

@@ -32,7 +32,7 @@ class BenchmarkResultPrinter {
/// [name] is a computer-readable name of the result used as a key in the JSON
/// serialization of the results.
void addResult({ @required String description, @required double value, @required String unit, @required String name }) {
_results.add(new _BenchmarkResult(description, value, unit, name));
_results.add(_BenchmarkResult(description, value, unit, name));
}
/// Prints the results added via [addResult] to standard output, once as JSON
@@ -58,7 +58,7 @@ class BenchmarkResultPrinter {
}
String _printPlainText() {
final StringBuffer buf = new StringBuffer();
final StringBuffer buf = StringBuffer();
for (_BenchmarkResult result in _results) {
buf.writeln('${result.description}: ${result.value.toStringAsFixed(1)} ${result.unit}');
}

View File

@@ -10,8 +10,8 @@ import 'data/velocity_tracker_data.dart';
const int _kNumIters = 10000;
void main() {
final VelocityTracker tracker = new VelocityTracker();
final Stopwatch watch = new Stopwatch();
final VelocityTracker tracker = VelocityTracker();
final Stopwatch watch = Stopwatch();
print('Velocity tracker benchmark...');
watch.start();
for (int i = 0; i < _kNumIters; i += 1) {
@@ -24,7 +24,7 @@ void main() {
}
watch.stop();
final BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
final BenchmarkResultPrinter printer = BenchmarkResultPrinter();
printer.addResult(
description: 'Velocity tracker',
value: watch.elapsedMicroseconds / _kNumIters,

View File

@@ -37,9 +37,9 @@ Future<Null> main() async {
assert(false); // don't run this in checked mode! Use --release.
stock_data.StockData.actuallyFetchData = false;
final Stopwatch wallClockWatch = new Stopwatch();
final Stopwatch cpuWatch = new Stopwatch();
new BenchmarkingBinding(cpuWatch);
final Stopwatch wallClockWatch = Stopwatch();
final Stopwatch cpuWatch = Stopwatch();
BenchmarkingBinding(cpuWatch);
int totalOpenFrameElapsedMicroseconds = 0;
int totalOpenIterationCount = 0;
@@ -80,7 +80,7 @@ Future<Null> main() async {
}
});
final BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
final BenchmarkResultPrinter printer = BenchmarkResultPrinter();
printer.addResult(
description: 'Stock animation',
value: wallClockWatch.elapsedMicroseconds / (1000 * 1000),

View File

@@ -23,7 +23,7 @@ Future<Null> main() async {
// the engine, so that the engine does not interfere with our timings.
final LiveTestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
final Stopwatch watch = new Stopwatch();
final Stopwatch watch = Stopwatch();
int iterations = 0;
await benchmarkWidgets((WidgetTester tester) async {
@@ -46,7 +46,7 @@ Future<Null> main() async {
// frames are missed, etc.
// We use Timer.run to ensure there's a microtask flush in between
// the two calls below.
Timer.run(() { ui.window.onBeginFrame(new Duration(milliseconds: iterations * 16)); });
Timer.run(() { ui.window.onBeginFrame(Duration(milliseconds: iterations * 16)); });
Timer.run(() { ui.window.onDrawFrame(); });
await tester.idle(); // wait until the frame has run (also uses Timer.run)
iterations += 1;
@@ -54,7 +54,7 @@ Future<Null> main() async {
watch.stop();
});
final BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
final BenchmarkResultPrinter printer = BenchmarkResultPrinter();
printer.addResult(
description: 'Stock build',
value: watch.elapsedMicroseconds / iterations,

View File

@@ -22,7 +22,7 @@ Future<Null> main() async {
// the engine, so that the engine does not interfere with our timings.
final LiveTestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
final Stopwatch watch = new Stopwatch();
final Stopwatch watch = Stopwatch();
int iterations = 0;
await benchmarkWidgets((WidgetTester tester) async {
@@ -37,8 +37,8 @@ Future<Null> main() async {
ui.window.onBeginFrame = null;
ui.window.onDrawFrame = null;
final TestViewConfiguration big = new TestViewConfiguration(size: const Size(360.0, 640.0));
final TestViewConfiguration small = new TestViewConfiguration(size: const Size(355.0, 635.0));
final TestViewConfiguration big = TestViewConfiguration(size: const Size(360.0, 640.0));
final TestViewConfiguration small = TestViewConfiguration(size: const Size(355.0, 635.0));
final RenderView renderView = WidgetsBinding.instance.renderView;
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
@@ -51,7 +51,7 @@ Future<Null> main() async {
// frames are missed, etc.
// We use Timer.run to ensure there's a microtask flush in between
// the two calls below.
Timer.run(() { binding.handleBeginFrame(new Duration(milliseconds: iterations * 16)); });
Timer.run(() { binding.handleBeginFrame(Duration(milliseconds: iterations * 16)); });
Timer.run(() { binding.handleDrawFrame(); });
await tester.idle(); // wait until the frame has run (also uses Timer.run)
iterations += 1;
@@ -59,7 +59,7 @@ Future<Null> main() async {
watch.stop();
});
final BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
final BenchmarkResultPrinter printer = BenchmarkResultPrinter();
printer.addResult(
description: 'Stock layout',
value: watch.elapsedMicroseconds / iterations,