Skip to content

Commit fa940cf

Browse files
benjamingrrvagg
authored andcommitted
fs: remove unused branches
In a few places the code was refactored to use `maybeCallback` which always returns a function. Checking for `if (callback)` always returns true anyway. PR-URL: #4795 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: thefourtheye <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent 386ad7e commit fa940cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/fs.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1146,16 +1146,16 @@ function writeAll(fd, isUserFd, buffer, offset, length, position, callback_) {
11461146
fs.write(fd, buffer, offset, length, position, function(writeErr, written) {
11471147
if (writeErr) {
11481148
if (isUserFd) {
1149-
if (callback) callback(writeErr);
1149+
callback(writeErr);
11501150
} else {
11511151
fs.close(fd, function() {
1152-
if (callback) callback(writeErr);
1152+
callback(writeErr);
11531153
});
11541154
}
11551155
} else {
11561156
if (written === length) {
11571157
if (isUserFd) {
1158-
if (callback) callback(null);
1158+
callback(null);
11591159
} else {
11601160
fs.close(fd, callback);
11611161
}
@@ -1193,7 +1193,7 @@ fs.writeFile = function(path, data, options, callback_) {
11931193

11941194
fs.open(path, flag, options.mode, function(openErr, fd) {
11951195
if (openErr) {
1196-
if (callback) callback(openErr);
1196+
callback(openErr);
11971197
} else {
11981198
writeFd(fd, false);
11991199
}

0 commit comments

Comments
 (0)