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 <[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]>
  • Loading branch information
Trott authored and gibfahn committed Dec 20, 2017
1 parent 97a264e commit f1de0da
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 f1de0da

Please sign in to comment.