Skip to content

Commit 8001541

Browse files
authored
refactor: remove redundant variables (#36)
1 parent 5c81e11 commit 8001541

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lua/img-clip/drag_and_drop.lua

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ local handle_image_url = function(url)
2020

2121
-- mkdir if not exists
2222
local dir_path = vim.fn.fnamemodify(file_path, ":h")
23-
local dir_ok = fs.mkdirp(dir_path)
24-
if not dir_ok then
23+
if not fs.mkdirp(dir_path) then
2524
util.error("Could not create directories.")
2625
return false
2726
end
@@ -59,15 +58,13 @@ local handle_image_path = function(path)
5958
if file_path then
6059
-- mkdir if not exists
6160
local dir_path = vim.fn.fnamemodify(file_path, ":h")
62-
local dirs_created = fs.mkdirp(dir_path)
63-
if not dirs_created then
61+
if not fs.mkdirp(dir_path) then
6462
util.error("Could not create directories.")
6563
return false
6664
end
6765

6866
-- copy image to specified file path
69-
local copy_ok = fs.copy_file(path, file_path)
70-
if not copy_ok then
67+
if not fs.copy_file(path, file_path) then
7168
util.error("Could not copy image.")
7269
return false
7370
end

0 commit comments

Comments
 (0)