From 0cb27d9028af629c1fd0d66c58a1222d43d0f2ad Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Tue, 5 Sep 2023 16:30:05 +0400 Subject: [PATCH] Group some if` conditions from `Server:initialize` The conditions like if a == nil and b == nil then c = 'something' end if a == nil and b then c = 'something else' end going in a row look a little strange. This patch groups similar conditions from the `Server:initialize` function into the following construction: if a == nil then if b == nil then c = 'something' else c = 'something else' end end --- luatest/server.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/luatest/server.lua b/luatest/server.lua index 533b46e..60a4a1a 100644 --- a/luatest/server.lua +++ b/luatest/server.lua @@ -147,11 +147,12 @@ function Server:initialize() self.http_client = http_client.new() end - if self.net_box_uri == nil and self.net_box_port == nil then - self.net_box_uri = self.build_listen_uri(self.alias, self.rs_id or self.id) - end - if self.net_box_uri == nil and self.net_box_port then - self.net_box_uri = 'localhost:' .. self.net_box_port + if self.net_box_uri == nil then + if self.net_box_port == nil then + self.net_box_uri = self.build_listen_uri(self.alias, self.rs_id or self.id) + else + self.net_box_uri = 'localhost:' .. self.net_box_port + end end self.env = utils.merge(self.env or {}, self:build_env())