Skip to content

Commit

Permalink
doc,test: remove unnecessary await with return instances
Browse files Browse the repository at this point in the history
Remove unnecessary `await` in combination with `return` in preparation
for enabling lint rule.

PR-URL: #17265
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed Dec 12, 2017
1 parent 78592a3 commit a256482
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For example:
const util = require('util');

async function fn() {
return await Promise.resolve('hello world');
return 'hello world';
}
const callbackFunction = util.callbackify(fn);

Expand Down
2 changes: 1 addition & 1 deletion test/common/inspector-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class NodeInstance {
console.log('[test]', 'Connecting to a child Node process');
const response = await this.httpGet(null, '/json/list');
const url = response[0]['webSocketDebuggerUrl'];
return await this.wsHandshake(url);
return this.wsHandshake(url);
}

expectShutdown() {
Expand Down
10 changes: 5 additions & 5 deletions test/parallel/test-util-callbackify.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const values = [
for (const value of values) {
// Test and `async function`
async function asyncFn() {
return await Promise.resolve(value);
return value;
}

const cbAsyncFn = callbackify(asyncFn);
Expand Down Expand Up @@ -70,7 +70,7 @@ const values = [
for (const value of values) {
// Test an `async function`
async function asyncFn() {
return await Promise.reject(value);
return Promise.reject(value);
}

const cbAsyncFn = callbackify(asyncFn);
Expand Down Expand Up @@ -142,7 +142,7 @@ const values = [
for (const value of values) {
async function asyncFn(arg) {
assert.strictEqual(arg, value);
return await Promise.resolve(arg);
return arg;
}

const cbAsyncFn = callbackify(asyncFn);
Expand Down Expand Up @@ -183,7 +183,7 @@ const values = [
const iAmThat = {
async fn(arg) {
assert.strictEqual(this, iAmThat);
return await Promise.resolve(arg);
return arg;
},
};
iAmThat.cbFn = callbackify(iAmThat.fn);
Expand Down Expand Up @@ -241,7 +241,7 @@ const values = [

{
async function asyncFn() {
return await Promise.resolve(42);
return 42;
}

const cb = callbackify(asyncFn);
Expand Down

0 comments on commit a256482

Please sign in to comment.