Skip to content

Commit a256482

Browse files
TrottMylesBorins
authored andcommitted
doc,test: remove unnecessary await with return instances
Remove unnecessary `await` in combination with `return` in preparation for enabling lint rule. PR-URL: #17265 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 78592a3 commit a256482

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

‎doc/api/util.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ For example:
3131
constutil=require('util');
3232

3333
asyncfunctionfn(){
34-
returnawaitPromise.resolve('hello world');
34+
return'hello world';
3535
}
3636
constcallbackFunction=util.callbackify(fn);
3737

‎test/common/inspector-helper.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class NodeInstance{
390390
console.log('[test]','Connecting to a child Node process');
391391
constresponse=awaitthis.httpGet(null,'/json/list');
392392
consturl=response[0]['webSocketDebuggerUrl'];
393-
returnawaitthis.wsHandshake(url);
393+
returnthis.wsHandshake(url);
394394
}
395395

396396
expectShutdown(){

‎test/parallel/test-util-callbackify.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const values = [
2828
for(constvalueofvalues){
2929
// Test and `async function`
3030
asyncfunctionasyncFn(){
31-
returnawaitPromise.resolve(value);
31+
returnvalue;
3232
}
3333

3434
constcbAsyncFn=callbackify(asyncFn);
@@ -70,7 +70,7 @@ const values = [
7070
for(constvalueofvalues){
7171
// Test an `async function`
7272
asyncfunctionasyncFn(){
73-
returnawaitPromise.reject(value);
73+
returnPromise.reject(value);
7474
}
7575

7676
constcbAsyncFn=callbackify(asyncFn);
@@ -142,7 +142,7 @@ const values = [
142142
for(constvalueofvalues){
143143
asyncfunctionasyncFn(arg){
144144
assert.strictEqual(arg,value);
145-
returnawaitPromise.resolve(arg);
145+
returnarg;
146146
}
147147

148148
constcbAsyncFn=callbackify(asyncFn);
@@ -183,7 +183,7 @@ const values = [
183183
constiAmThat={
184184
asyncfn(arg){
185185
assert.strictEqual(this,iAmThat);
186-
returnawaitPromise.resolve(arg);
186+
returnarg;
187187
},
188188
};
189189
iAmThat.cbFn=callbackify(iAmThat.fn);
@@ -241,7 +241,7 @@ const values = [
241241

242242
{
243243
asyncfunctionasyncFn(){
244-
returnawaitPromise.resolve(42);
244+
return42;
245245
}
246246

247247
constcb=callbackify(asyncFn);

0 commit comments

Comments
(0)