darklua
DocumentationTry itGitHub

remove_unused_variable


Added in 0.13.0

This rule removes unused variables from code. It also removes unused local function definitions.

Examples


local var
local var1 = true
local var2 = var1
local var = call()
local function fn() print('unused') end
local a, b, c = 1, 2, 3
return a
InputOutput
local var
 
local var1 = true
local var2 = var1


local var = call()
call()
local function fn() print('unused') end
 
local a, b, c = 1, 2, 3
return a
local a=1
return a