Skip to content

Comments

Keep small prefix inlined in call chain#550

Merged
JohnnyMorganz merged 4 commits intomainfrom
keep-small-prefix-inlined
Aug 21, 2022
Merged

Keep small prefix inlined in call chain#550
JohnnyMorganz merged 4 commits intomainfrom
keep-small-prefix-inlined

Conversation

@JohnnyMorganz
Copy link
Owner

Fixes #514

@codecov
Copy link

codecov bot commented Aug 21, 2022

Codecov Report

Merging #550 (1b8bec8) into main (096bbeb) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #550      +/-   ##
==========================================
- Coverage   97.80%   97.80%   -0.01%     
==========================================
  Files          14       14              
  Lines        5420     5419       -1     
==========================================
- Hits         5301     5300       -1     
  Misses        119      119              
Impacted Files Coverage Δ
src/formatters/trivia.rs 100.00% <ø> (ø)
src/formatters/functions.rs 98.61% <100.00%> (-0.01%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link
Contributor

Repo Comparison Test

diff --git ORI/luvit/examples/http-server-todo-web.lua ALT/luvit/examples/http-server-todo-web.lua
index de3c1df..c08beea 100644
--- ORI/luvit/examples/http-server-todo-web.lua
+++ ALT/luvit/examples/http-server-todo-web.lua
@@ -2,22 +2,20 @@ local http = require("http")
 local url = require("url")
 local items = {}
 -- see Node.js_in_action.pdf : page 89 (110 of 417)
-http
-	.createServer(function(req, res)
-		--p(req)
-		if req.url == "/" then
-			if req.method == "GET" then
-				show(res)
-			elseif req.method == "POST" then
-				add(req, res)
-			else
-				badRequest(res)
-			end
+http.createServer(function(req, res)
+	--p(req)
+	if req.url == "/" then
+		if req.method == "GET" then
+			show(res)
+		elseif req.method == "POST" then
+			add(req, res)
 		else
-			notFound(res)
+			badRequest(res)
 		end
-	end)
-	:listen(8080)
+	else
+		notFound(res)
+	end
+end):listen(8080)
 
 function map(a, fcn)
 	local b = {}
diff --git ORI/luvit/examples/http-upload.lua ALT/luvit/examples/http-upload.lua
index e800d5a..5950c9d 100644
--- ORI/luvit/examples/http-upload.lua
+++ ALT/luvit/examples/http-upload.lua
@@ -2,27 +2,25 @@ local http = require("http")
 local utils = require("utils")
 local table = require("table")
 
-http
-	.createServer(function(req, res)
-		p("on_request", req)
-		local chunks = {}
-		local length = 0
-		req:on("data", function(chunk, len)
-			p("on_data", { len = len })
-			length = length + 1
-			chunks[length] = chunk
-		end)
-		req:on("end", function()
-			local body = table.concat(chunks, "")
-			p("on_end", { total_len = #body })
-			body = "length = " .. tostring(#body) .. "\n"
-			res:writeHead(200, {
-				["Content-Type"] = "text/plain",
-				["Content-Length"] = #body,
-			})
-			res:finish(body)
-		end)
+http.createServer(function(req, res)
+	p("on_request", req)
+	local chunks = {}
+	local length = 0
+	req:on("data", function(chunk, len)
+		p("on_data", { len = len })
+		length = length + 1
+		chunks[length] = chunk
 	end)
-	:listen(8080)
+	req:on("end", function()
+		local body = table.concat(chunks, "")
+		p("on_end", { total_len = #body })
+		body = "length = " .. tostring(#body) .. "\n"
+		res:writeHead(200, {
+			["Content-Type"] = "text/plain",
+			["Content-Length"] = #body,
+		})
+		res:finish(body)
+	end)
+end):listen(8080)
 
 print("Server listening at http://localhost:8080/")
diff --git ORI/luvit/tests/test-url.lua ALT/luvit/tests/test-url.lua
index 105e660..88a1867 100644
--- ORI/luvit/tests/test-url.lua
+++ ALT/luvit/tests/test-url.lua
@@ -86,7 +86,11 @@ local relativeTests = {
 		"https://u:p@h.com/p/a/t/h?s#hash2",
 	},
 	{ "http://example.com/b//c//d;p?q#blarg", "https://a/b/c/d", "https://a/b/c/d" },
-	{ "http://example.com/b//c//d;p?q#blarg", "http://u:p@h.com/p/a/t/h?s#hash2", "http://u:p@h.com/p/a/t/h?s#hash2" },
+	{
+		"http://example.com/b//c//d;p?q#blarg",
+		"http://u:p@h.com/p/a/t/h?s#hash2",
+		"http://u:p@h.com/p/a/t/h?s#hash2",
+	},
 	{ "/foo/bar/baz", "/../etc/passwd", "/etc/passwd" },
 	{ "http://localhost", "file://foo/Users", "file://foo/Users" },
 	-- from node
diff --git ORI/lit/commands/serve.lua ALT/lit/commands/serve.lua
index 38e6078..183600b 100644
--- ORI/lit/commands/serve.lua
+++ ALT/lit/commands/serve.lua
@@ -38,10 +38,8 @@ return function()
 	end)
 
 	app.use(require("weblit-auto-headers"))
-.route({ method = "GET", path = "/snapshots" }, require("snapshots")).route(
-		{ method = "GET", path = "/stats" },
-		require("stats")
-	)
+		.route({ method = "GET", path = "/snapshots" }, require("snapshots"))
+		.route({ method = "GET", path = "/stats" }, require("stats"))
 
 	-- Handle websocket clients
 	app.websocket({

@JohnnyMorganz JohnnyMorganz merged commit 934393d into main Aug 21, 2022
@JohnnyMorganz JohnnyMorganz deleted the keep-small-prefix-inlined branch August 21, 2022 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reversability issue in inspect.lua from luvit

1 participant