1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: write empty or blocks the same as empty fn bodies, empty structs, etc (#9136)

This commit is contained in:
Lukas Neubert
2021-03-06 20:04:51 +01:00
committed by GitHub
parent 7a9d9f1e78
commit fdcfe397d4
17 changed files with 48 additions and 38 deletions

View File

@@ -35,7 +35,7 @@ fn parse_request(mut reader io.BufferedReader) ?http.Request {
n := length.int()
if n > 0 {
body = []byte{len: n}
reader.read(mut body) or { }
reader.read(mut body) or {}
}
}

View File

@@ -20,7 +20,7 @@ const (
fn testsuite_begin() {
os.chdir(vroot)
if os.exists(serverexe) {
os.rm(serverexe) or { }
os.rm(serverexe) or {}
}
}
@@ -260,7 +260,7 @@ fn simple_tcp_client(config SimpleTcpClientConfig) ?string {
client.set_read_timeout(tcp_r_timeout)
client.set_write_timeout(tcp_w_timeout)
defer {
client.close() or { }
client.close() or {}
}
message := 'GET $config.path HTTP/1.1
Host: $config.host

View File

@@ -169,7 +169,7 @@ pub fn (mut ctx Context) server_error(ecode int) Result {
if ctx.done {
return Result{}
}
send_string(mut ctx.conn, vweb.http_500) or { }
send_string(mut ctx.conn, vweb.http_500) or {}
return Result{}
}
@@ -191,7 +191,7 @@ pub fn (mut ctx Context) not_found() Result {
return Result{}
}
ctx.done = true
send_string(mut ctx.conn, vweb.http_404) or { }
send_string(mut ctx.conn, vweb.http_404) or {}
return Result{}
}
@@ -301,7 +301,7 @@ fn handle_conn<T>(mut conn net.TcpConn, mut app T) {
conn.set_read_timeout(30 * time.second)
conn.set_write_timeout(30 * time.second)
defer {
conn.close() or { }
conn.close() or {}
}
mut reader := io.new_buffered_reader(reader: io.make_reader(conn))
page_gen_start := time.ticks()
@@ -321,7 +321,7 @@ fn handle_conn<T>(mut conn net.TcpConn, mut app T) {
if 'multipart/form-data' in req.lheaders['content-type'].split('; ') {
boundary := req.lheaders['content-type'].split('; ').filter(it.starts_with('boundary='))
if boundary.len != 1 {
send_string(mut conn, vweb.http_400) or { }
send_string(mut conn, vweb.http_400) or {}
return
}
form, files := parse_multipart_form(req.data, boundary[0][9..])
@@ -400,7 +400,7 @@ fn handle_conn<T>(mut conn net.TcpConn, mut app T) {
}
}
// site not found
send_string(mut conn, vweb.http_404) or { }
send_string(mut conn, vweb.http_404) or {}
}
fn route_matches(url_words []string, route_words []string) ?[]string {
@@ -493,7 +493,7 @@ fn serve_static<T>(mut app T, url urllib.URL) bool {
return false
}
data := os.read_file(static_file) or {
send_string(mut app.conn, vweb.http_404) or { }
send_string(mut app.conn, vweb.http_404) or {}
return true
}
app.send_response_to_client(mime_type, data)