Skip to content

Commit a188577

Browse files
committed
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
1 parent 7d1358c commit a188577

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

luatest/server.lua

+6-5
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,12 @@ function Server:initialize()
149149
self.http_client = http_client.new()
150150
end
151151

152-
if self.net_box_uri == nil and self.net_box_port == nil then
153-
self.net_box_uri = self.build_listen_uri(self.alias, self.rs_id or self.id)
154-
end
155-
if self.net_box_uri == nil and self.net_box_port then
156-
self.net_box_uri = 'localhost:' .. self.net_box_port
152+
if self.net_box_uri == nil then
153+
if self.net_box_port == nil then
154+
self.net_box_uri = self.build_listen_uri(self.alias, self.rs_id or self.id)
155+
else
156+
self.net_box_uri = 'localhost:' .. self.net_box_port
157+
end
157158
end
158159
if uri.parse(self.net_box_uri).host == 'unix/' then
159160
-- Linux uses max 108 bytes for Unix domain socket paths, which means a 107 characters

0 commit comments

Comments
 (0)