(v6.x backport) tools: remove unnecessary function declaration and make code a bit more readable
Backport of https://github.com/nodejs/node/pull/17125.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
tools