-
Notifications
You must be signed in to change notification settings - Fork 82
Add unnecessary await in return lint #1981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3c0ffbb
16a5596
c3a99a8
b7ca764
5427e42
bdb83ab
74a0912
fde29be
b59be5b
af3333b
e798508
a687156
a39fc04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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))); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Less interesting case since it doesn't become a tearoff, but if the sole There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks Nate, I will skip this PR for now and add the suggested change separately. |
||||||
} | ||||||
|
||||||
/// Return elements of the list from [properties]. | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,7 +273,7 @@ class Locations { | |
Future<Set<Location>> _locationsForModule(String module) async { | ||
final memoizer = _locationMemoizer.putIfAbsent(module, AsyncMemoizer.new); | ||
|
||
return await memoizer.runOnce(() async { | ||
return memoizer.runOnce(() async { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, will do! |
||
if (_moduleToLocations.containsKey(module)) { | ||
return _moduleToLocations[module]!; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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<ScriptList> getScripts(String isolateId) async { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could drop There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do, thanks! |
||
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<String>? 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 { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd have to measure to be sure, but removing an
async
along with theawait
does have a chance at bringing perf improvements. In the cases where it was the onlyawait
in the method it could be worth removing along with theasync
- even if for only style reasons.This case is nice because it can go further and become a tearoff. I'd make this change independent of the rest of the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do, thanks! I wasn't sure if there is any change in semantics:)