From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 3813725E04 for ; Fri, 26 Jul 2019 18:17:44 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tsSrrOysXvSR for ; Fri, 26 Jul 2019 18:17:44 -0400 (EDT) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E45B725DFE for ; Fri, 26 Jul 2019 18:17:43 -0400 (EDT) Received: by mail-lf1-f43.google.com with SMTP id c19so38082898lfm.10 for ; Fri, 26 Jul 2019 15:17:43 -0700 (PDT) From: Cyrill Gorcunov Subject: [tarantool-patches] [PATCH 2/3] box/console: Drop redundant status parameter from return Date: Sat, 27 Jul 2019 01:17:11 +0300 Message-Id: <20190726221712.11191-3-gorcunov@gmail.com> In-Reply-To: <20190726221712.11191-1-gorcunov@gmail.com> References: <20190726221712.11191-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tml Cc: Alexander Turenko , Konstantin Osipov , Cyrill Gorcunov In output_verify_opts and output_parse we return status variable to point if function processed without error. This is redundant we can simply return either error or nil, which is enough. Part-of #3834 --- src/box/lua/console.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua index 9258e7bbb..0c521b44a 100644 --- a/src/box/lua/console.lua +++ b/src/box/lua/console.lua @@ -72,15 +72,15 @@ end local function output_verify_opts(fmt, opts) if opts == nil then - return true, nil + return nil end if fmt == "lua" then if opts ~= "line" and opts ~= "block" then local msg = 'Wrong option "%s", expecting: line or block.' - return false, msg:format(opts) + return msg:format(opts) end end - return true, nil + return nil end local function output_parse(value) @@ -92,23 +92,23 @@ local function output_parse(value) end for k, _ in pairs(output_handlers) do if k == fmt then - local status, err = output_verify_opts(fmt, opts) - if status ~= true then - return false, err + local err = output_verify_opts(fmt, opts) + if err then + return err end - return true, nil, fmt, opts + return nil, fmt, opts end end local msg = 'Invalid format "%s", supported languages: lua and yaml.' - return false, msg:format(value) + return msg:format(value) end local function set_default_output(value) if value == nil then error("Nil output value passed") end - local status, err, fmt, opts = output_parse(value) - if status ~= true then + local err, fmt, opts = output_parse(value) + if err then error(err) end default_output_format["fmt"] = fmt @@ -180,8 +180,8 @@ local function set_language(storage, value) end local function set_output(storage, value) - local status, err, fmt, opts = output_parse(value) - if status ~= true then + local err, fmt, opts = output_parse(value) + if err then return error(err) end output_save(fmt, opts) -- 2.20.1