From 13a0eeca1affbd261616ea2ef8d360d71c3e537d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 6 May 2015 19:50:40 +0100 Subject: util.set: Remove unnecessary local declaration, arguments are already locals [luacheck] --- util/set.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/set.lua') diff --git a/util/set.lua b/util/set.lua index 04f5f0f4..c160d28e 100644 --- a/util/set.lua +++ b/util/set.lua @@ -34,7 +34,7 @@ function set_mt.__div(set, func) return new_set; end function set_mt.__eq(set1, set2) - local set1, set2 = set1._items, set2._items; + set1, set2 = set1._items, set2._items; for item in pairs(set1) do if not set2[item] then return false; -- cgit v1.2.3 From d16104ebd4ea1a5e313367064c6731efb6feed21 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 6 May 2015 19:51:07 +0100 Subject: util.set: Add luacheck annotation for methods not referencing 'self' --- util/set.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util/set.lua') diff --git a/util/set.lua b/util/set.lua index c160d28e..0a263440 100644 --- a/util/set.lua +++ b/util/set.lua @@ -66,6 +66,9 @@ function new(list) local items = setmetatable({}, items_mt); local set = { _items = items }; + -- We access the set through an upvalue in these methods, so ignore 'self' being unused + --luacheck: ignore 212/self + function set:add(item) items[item] = true; end -- cgit v1.2.3 From de51b150af7229ca6d30cdaa89e5201cfce59715 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 6 May 2015 19:51:35 +0100 Subject: util.set: Rename method argument to avoid name clash [luacheck] --- util/set.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util/set.lua') diff --git a/util/set.lua b/util/set.lua index 0a263440..4be39c17 100644 --- a/util/set.lua +++ b/util/set.lua @@ -85,9 +85,9 @@ function new(list) items[item] = nil; end - function set:add_list(list) - if list then - for _, item in ipairs(list) do + function set:add_list(item_list) + if item_list then + for _, item in ipairs(item_list) do items[item] = true; end end -- cgit v1.2.3