refactor: Address issues raised by linter

This commit is contained in:
Thijs Schreijer
2022-03-18 12:12:39 +01:00
committed by Caleb Maclennan
parent 480c052572
commit 601ad8d59f
21 changed files with 187 additions and 198 deletions

View File

@ -10,7 +10,6 @@
local base = _G
local ltn12 = require("ltn12")
local mime = require("mime.core")
local string = require("string")
local _M = mime
-- encode, decode and wrap algorithm tables
@ -18,7 +17,7 @@ local encodet, decodet, wrapt = {},{},{}
_M.encodet = encodet
_M.decodet = decodet
_M.wrapt = wrapt
_M.wrapt = wrapt
-- creates a function that chooses a filter by name from a given table
local function choose(table)
@ -27,7 +26,7 @@ local function choose(table)
name, opt1, opt2 = "default", name, opt1
end
local f = table[name or "nil"]
if not f then
if not f then
base.error("unknown key (" .. base.tostring(name) .. ")", 3)
else return f(opt1, opt2) end
end
@ -52,13 +51,6 @@ decodet['quoted-printable'] = function()
return ltn12.filter.cycle(_M.unqp, "")
end
local function format(chunk)
if chunk then
if chunk == "" then return "''"
else return string.len(chunk) end
else return "nil" end
end
-- define the line-wrap filters
wrapt['text'] = function(length)
length = length or 76