diff options
| author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2022-03-18 12:12:39 +0100 |
|---|---|---|
| committer | Caleb Maclennan <caleb@alerque.com> | 2022-03-19 17:13:15 +0300 |
| commit | 601ad8d59f11d7180015d0ecfb9d0a8d67f6f5c1 (patch) | |
| tree | e3b9c152b9ff8a431d1431edb0a42d051d256f13 /src/mime.lua | |
| parent | 480c05257211b3e566f33fdf8cf051233e2dab30 (diff) | |
| download | luasocket-601ad8d59f11d7180015d0ecfb9d0a8d67f6f5c1.tar.gz luasocket-601ad8d59f11d7180015d0ecfb9d0a8d67f6f5c1.tar.bz2 luasocket-601ad8d59f11d7180015d0ecfb9d0a8d67f6f5c1.zip | |
refactor: Address issues raised by linter
Diffstat (limited to 'src/mime.lua')
| -rw-r--r-- | src/mime.lua | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/mime.lua b/src/mime.lua index d3abac5..93539de 100644 --- a/src/mime.lua +++ b/src/mime.lua | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | local base = _G | 10 | local base = _G |
| 11 | local ltn12 = require("ltn12") | 11 | local ltn12 = require("ltn12") |
| 12 | local mime = require("mime.core") | 12 | local mime = require("mime.core") |
| 13 | local string = require("string") | ||
| 14 | local _M = mime | 13 | local _M = mime |
| 15 | 14 | ||
| 16 | -- encode, decode and wrap algorithm tables | 15 | -- encode, decode and wrap algorithm tables |
| @@ -18,7 +17,7 @@ local encodet, decodet, wrapt = {},{},{} | |||
| 18 | 17 | ||
| 19 | _M.encodet = encodet | 18 | _M.encodet = encodet |
| 20 | _M.decodet = decodet | 19 | _M.decodet = decodet |
| 21 | _M.wrapt = wrapt | 20 | _M.wrapt = wrapt |
| 22 | 21 | ||
| 23 | -- creates a function that chooses a filter by name from a given table | 22 | -- creates a function that chooses a filter by name from a given table |
| 24 | local function choose(table) | 23 | local function choose(table) |
| @@ -27,7 +26,7 @@ local function choose(table) | |||
| 27 | name, opt1, opt2 = "default", name, opt1 | 26 | name, opt1, opt2 = "default", name, opt1 |
| 28 | end | 27 | end |
| 29 | local f = table[name or "nil"] | 28 | local f = table[name or "nil"] |
| 30 | if not f then | 29 | if not f then |
| 31 | base.error("unknown key (" .. base.tostring(name) .. ")", 3) | 30 | base.error("unknown key (" .. base.tostring(name) .. ")", 3) |
| 32 | else return f(opt1, opt2) end | 31 | else return f(opt1, opt2) end |
| 33 | end | 32 | end |
| @@ -52,13 +51,6 @@ decodet['quoted-printable'] = function() | |||
| 52 | return ltn12.filter.cycle(_M.unqp, "") | 51 | return ltn12.filter.cycle(_M.unqp, "") |
| 53 | end | 52 | end |
| 54 | 53 | ||
| 55 | local function format(chunk) | ||
| 56 | if chunk then | ||
| 57 | if chunk == "" then return "''" | ||
| 58 | else return string.len(chunk) end | ||
| 59 | else return "nil" end | ||
| 60 | end | ||
| 61 | |||
| 62 | -- define the line-wrap filters | 54 | -- define the line-wrap filters |
| 63 | wrapt['text'] = function(length) | 55 | wrapt['text'] = function(length) |
| 64 | length = length or 76 | 56 | length = length or 76 |
