diff --git a/dwds/analysis_options.yaml b/dwds/analysis_options.yaml index a7786007a..465e72c04 100644 --- a/dwds/analysis_options.yaml +++ b/dwds/analysis_options.yaml @@ -20,4 +20,5 @@ linter: - prefer_final_locals - unawaited_futures - avoid_void_async + - unnecessary_await_in_return - unnecessary_lambdas diff --git a/dwds/debug_extension_mv3/web/debug_session.dart b/dwds/debug_extension_mv3/web/debug_session.dart index b101b42e8..27c093656 100644 --- a/dwds/debug_extension_mv3/web/debug_session.dart +++ b/dwds/debug_extension_mv3/web/debug_session.dart @@ -477,7 +477,7 @@ Future _sendConnectFailureMessage(ConnectFailureReason reason, final json = jsonEncode(serializers.serialize(ConnectFailure((b) => b ..tabId = dartAppTabId ..reason = reason.name))); - return await sendRuntimeMessage( + return sendRuntimeMessage( type: MessageType.connectFailure, body: json, sender: Script.background, @@ -490,7 +490,7 @@ Future _sendStopDebuggingMessage(DetachReason reason, ..tabId = dartAppTabId ..reason = reason.name ..newState = DebugStateChange.stopDebugging))); - return await sendRuntimeMessage( + return sendRuntimeMessage( type: MessageType.debugStateChange, body: json, sender: Script.background, diff --git a/dwds/lib/src/debugging/debugger.dart b/dwds/lib/src/debugging/debugger.dart index 21d797d16..ea361c93d 100644 --- a/dwds/lib/src/debugging/debugger.dart +++ b/dwds/lib/src/debugging/debugger.dart @@ -236,7 +236,7 @@ class Debugger extends Domain { final uri = oldRef?.uri; if (uri == null) return null; final dartUri = DartUri(uri, _root); - return await inspector.scriptRefFor(dartUri.serverPath); + return inspector.scriptRefFor(dartUri.serverPath); } Future reestablishBreakpoints( @@ -367,7 +367,7 @@ class Debugger extends Domain { // TODO(alanknight): Can these be moved to dart_scope.dart? final properties = await visibleProperties(debugger: this, frame: frame); final boundVariables = await Future.wait( - properties.map((property) async => await _boundVariable(property)), + properties.map((property) async => _boundVariable(property)), ); // Filter out variables that do not come from dart code, such as native @@ -469,7 +469,7 @@ class Debugger extends Domain { } } '''; - return await inspector.jsCallFunctionOn(receiver, expression, args); + return inspector.jsCallFunctionOn(receiver, expression, args); } // TODO(elliette): https://github.com/dart-lang/webdev/issues/1501 Re-enable diff --git a/dwds/lib/src/debugging/inspector.dart b/dwds/lib/src/debugging/inspector.dart index 795cf396d..6b0e5eef5 100644 --- a/dwds/lib/src/debugging/inspector.dart +++ b/dwds/lib/src/debugging/inspector.dart @@ -287,7 +287,7 @@ class AppInspector implements AppInspectorInterface { // it's not really a Dart object. if (isLibraryId(targetId)) { final library = await getObject(targetId) as Library; - return await _invokeLibraryFunction(library, selector, remoteArguments); + return _invokeLibraryFunction(library, selector, remoteArguments); } else { return _invokeMethod( remoteObjectFor(targetId), selector, remoteArguments); diff --git a/dwds/lib/src/debugging/instance.dart b/dwds/lib/src/debugging/instance.dart index 36eab3880..0a1295126 100644 --- a/dwds/lib/src/debugging/instance.dart +++ b/dwds/lib/src/debugging/instance.dart @@ -120,16 +120,16 @@ class InstanceHelper extends Domain { } if (metaData.isSystemList) { - return await _listInstanceFor(classRef, remoteObject, + return _listInstanceFor(classRef, remoteObject, offset: offset, count: count, length: metaData.length); } else if (metaData.isSystemMap) { - return await _mapInstanceFor(classRef, remoteObject, + return _mapInstanceFor(classRef, remoteObject, offset: offset, count: count, length: metaData.length); } else if (metaData.isRecord) { - return await _recordInstanceFor(classRef, remoteObject, + return _recordInstanceFor(classRef, remoteObject, offset: offset, count: count, length: metaData.length); } else { - return await _plainInstanceFor(classRef, remoteObject, + return _plainInstanceFor(classRef, remoteObject, offset: offset, count: count, length: metaData.length); } } @@ -354,8 +354,8 @@ class InstanceHelper extends Domain { count: count, elementCount: elements.length, length: length); final range = elements.sublist(0, rangeCount); - return Future.wait(range - .map((element) async => await _instanceRefForRemote(element.value))); + return Future.wait( + range.map((element) async => _instanceRefForRemote(element.value))); } /// Return elements of the list from [properties]. diff --git a/dwds/lib/src/debugging/location.dart b/dwds/lib/src/debugging/location.dart index ffaced033..885ce6eb9 100644 --- a/dwds/lib/src/debugging/location.dart +++ b/dwds/lib/src/debugging/location.dart @@ -273,7 +273,7 @@ class Locations { Future> _locationsForModule(String module) async { final memoizer = _locationMemoizer.putIfAbsent(module, AsyncMemoizer.new); - return await memoizer.runOnce(() async { + return memoizer.runOnce(() async { if (_moduleToLocations.containsKey(module)) { return _moduleToLocations[module]!; } diff --git a/dwds/lib/src/readers/proxy_server_asset_reader.dart b/dwds/lib/src/readers/proxy_server_asset_reader.dart index e84889bdf..fbfb33de6 100644 --- a/dwds/lib/src/readers/proxy_server_asset_reader.dart +++ b/dwds/lib/src/readers/proxy_server_asset_reader.dart @@ -60,7 +60,7 @@ class ProxyServerAssetReader implements AssetReader { '''); return null; } else { - return await response.readAsString(); + return response.readAsString(); } } diff --git a/dwds/lib/src/services/chrome_proxy_service.dart b/dwds/lib/src/services/chrome_proxy_service.dart index 8d07b5ff6..5e96b77a2 100644 --- a/dwds/lib/src/services/chrome_proxy_service.dart +++ b/dwds/lib/src/services/chrome_proxy_service.dart @@ -498,7 +498,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( _checkIsolate('evaluate', isolateId); final library = await inspector.getLibrary(targetId); - return await _getEvaluationResult( + return _getEvaluationResult( isolateId, () => evaluator.evaluateExpression( isolateId, library?.uri, expression, scope), @@ -522,7 +522,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( await isCompilerInitialized; _checkIsolate('evaluateInFrame', isolateId); - return await _getEvaluationResult( + return _getEvaluationResult( isolateId, () => evaluator.evaluateExpressionInFrame( isolateId, frameIndex, expression, scope), @@ -588,7 +588,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( @override Future getScripts(String isolateId) async { - return await captureElapsedTime(() async { + return captureElapsedTime(() async { await isInitialized; _checkIsolate('getScripts', isolateId); return inspector.getScripts(); @@ -606,10 +606,10 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( bool? reportLines, List? libraryFilters, }) async { - return await captureElapsedTime(() async { + return captureElapsedTime(() async { await isInitialized; _checkIsolate('getSourceReport', isolateId); - return await inspector.getSourceReport( + return inspector.getSourceReport( reports, scriptId: scriptId, tokenPos: tokenPos, @@ -771,7 +771,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( await isInitialized; await isStarted; _checkIsolate('resume', isolateId); - return await (await debuggerFuture) + return (await debuggerFuture) .resume(step: step, frameIndex: frameIndex); }, (result) => DwdsEvent.resume(step)); } else { diff --git a/dwds/test/puppeteer/extension_test.dart b/dwds/test/puppeteer/extension_test.dart index feb097ccf..b42c3e3f9 100644 --- a/dwds/test/puppeteer/extension_test.dart +++ b/dwds/test/puppeteer/extension_test.dart @@ -859,7 +859,7 @@ Future _getPanelPage( panelTarget ??= await browser.waitForTarget((target) => target.url.contains(panelName)); panelTarget.type = 'page'; - return await panelTarget.page; + return panelTarget.page; } Future _evaluateInPanel( diff --git a/dwds/test/puppeteer/test_utils.dart b/dwds/test/puppeteer/test_utils.dart index 5583e34b4..5f46ad280 100644 --- a/dwds/test/puppeteer/test_utils.dart +++ b/dwds/test/puppeteer/test_utils.dart @@ -54,7 +54,7 @@ Future setUpExtensionTest( isInternalBuild: isInternalBuild, isFlutterApp: isFlutterApp, ); - return await puppeteer.launch( + return puppeteer.launch( devTools: openChromeDevTools, headless: false, timeout: Duration(seconds: 60), diff --git a/dwds/web/reloader/require_restarter.dart b/dwds/web/reloader/require_restarter.dart index 558925c5a..5b2db8724 100644 --- a/dwds/web/reloader/require_restarter.dart +++ b/dwds/web/reloader/require_restarter.dart @@ -176,7 +176,7 @@ class RequireRestarter implements Restarter { // As function is async, it can potentially be called second time while // first invocation is still running. In this case just mark as dirty and // wait until loop from the first call will do the work - if (!_running.isCompleted) return await _running.future; + if (!_running.isCompleted) return _running.future; _running = Completer(); var reloadedModules = 0;