From 1ad9aca19472f0cf3818e96237605e30335e34ed Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 8 Oct 2020 21:32:56 -0400 Subject: [PATCH] fs: remove extraneous assignments in rmdir() validateRmOptions() doesn't return a value, so this commit removes the assignment. The options passed to validateRmdirOptions() are not used again after validation, so this commit removes the assignment. PR-URL: https://github.com/nodejs/node/pull/35567 Reviewed-By: Jiawen Geng Reviewed-By: Luigi Pinca Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rich Trott Reviewed-By: Anto Aravinth --- lib/fs.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index d07cefcaa9cb33..c570a8c9f4fc2e 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -859,20 +859,16 @@ function rmdir(path, options, callback) { path = pathModule.toNamespacedPath(getValidatedPath(path)); if (options && options.recursive) { - options = validateRmOptions( - path, - { ...options, force: true }, - (err, options) => { - if (err) { - return callback(err); - } - - lazyLoadRimraf(); - return rimraf(path, options, callback); - }); + validateRmOptions(path, { ...options, force: true }, (err, options) => { + if (err) { + return callback(err); + } + lazyLoadRimraf(); + return rimraf(path, options, callback); + }); } else { - options = validateRmdirOptions(options); + validateRmdirOptions(options); const req = new FSReqCallback(); req.oncomplete = callback; return binding.rmdir(path, req);