From efc8f7fb3ef7e90a088db64ad2c68dd0698b90d5 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 25 Jan 2026 20:59:51 +0200 Subject: [PATCH] examples: fix most notices for `./v -check-unused-fn-args -N build-examples` (remaining ones are triggered for vlib/x/json2/decode.v) --- examples/animated_help_text.v | 2 +- examples/archive/tar_gz_reader.v | 6 ++-- examples/cli.v | 4 +-- examples/eventbus/eventbus.v | 6 ++-- examples/gg/cursor.v | 2 +- examples/gg/easing_animation.v | 2 +- examples/gg/mandelbrot.v | 6 ++-- examples/gg/memory.v | 6 ++-- .../path_finding_algorithm_visualizer/aStar.v | 32 +++++-------------- examples/hot_reload/tunnel.v | 2 +- .../chart/draw.js.v | 2 +- examples/jsonrpc/server.v | 2 +- examples/news_fetcher.v | 2 +- examples/path_tracing.v | 10 +++--- examples/pico/pico.v | 2 +- examples/pico/raw_callback.v | 2 +- examples/snek/snek.v | 2 +- examples/sokol/drawing.v | 2 +- examples/ssl_server/server_sni.v | 2 +- examples/ssl_server/server_sni_advanced.v | 2 +- examples/veb/middleware/using_middleware.v | 7 ++-- vlib/archive/tar/reader.v | 2 +- vlib/datatypes/bstree.v | 2 +- vlib/net/http/http_proxy.v | 2 +- vlib/net/websocket/websocket_server.v | 2 +- vlib/picoev/picoev.v | 4 +-- vlib/picohttpparser/picohttpparser.v | 2 +- vlib/v/preludes/test_runner_normal.v | 4 +-- vlib/vweb/vweb.v | 2 +- vlib/x/json2/decode.v | 4 +-- vlib/x/json2/decode_sumtype.v | 6 ++-- 31 files changed, 56 insertions(+), 77 deletions(-) diff --git a/examples/animated_help_text.v b/examples/animated_help_text.v index a3254905d..6d43bb1af 100644 --- a/examples/animated_help_text.v +++ b/examples/animated_help_text.v @@ -21,7 +21,7 @@ mut: direction int = 1 } -fn event(e &tui.Event, mut app App) { +fn event(e &tui.Event, mut _app App) { match e.typ { .mouse_down {} .mouse_drag {} diff --git a/examples/archive/tar_gz_reader.v b/examples/archive/tar_gz_reader.v index 5d64734a4..0867ac6cb 100644 --- a/examples/archive/tar_gz_reader.v +++ b/examples/archive/tar_gz_reader.v @@ -65,9 +65,9 @@ fn new_downloader(url string) !&Downloader { return downloader } -fn (mut d Downloader) on_start(mut request http.Request, path string) ! {} +fn (mut d Downloader) on_start(mut _request http.Request, _path string) ! {} -fn (mut d Downloader) on_chunk(request &http.Request, chunk []u8, already_received u64, expected u64) ! { +fn (mut d Downloader) on_chunk(_request &http.Request, chunk []u8, _already_received u64, expected u64) ! { if expected == 0 { return } @@ -75,7 +75,7 @@ fn (mut d Downloader) on_chunk(request &http.Request, chunk []u8, already_receiv d.data << chunk } -fn (mut d Downloader) on_finish(request &http.Request, response &http.Response) ! {} +fn (mut d Downloader) on_finish(_request &http.Request, _response &http.Response) ! {} struct FileReader implements tar.Reader { ctx &Context diff --git a/examples/cli.v b/examples/cli.v index 5d748ecfb..4240c3901 100644 --- a/examples/cli.v +++ b/examples/cli.v @@ -71,10 +71,10 @@ fn greet_func(cmd Command) ! { } } -fn greet_pre_func(cmd Command) ! { +fn greet_pre_func(_cmd Command) ! { println('This is a function running before the main function.\n') } -fn greet_post_func(cmd Command) ! { +fn greet_post_func(_cmd Command) ! { println('\nThis is a function running after the main function.') } diff --git a/examples/eventbus/eventbus.v b/examples/eventbus/eventbus.v index a3e9a12b5..d85f5e2ae 100644 --- a/examples/eventbus/eventbus.v +++ b/examples/eventbus/eventbus.v @@ -19,15 +19,15 @@ fn main() { println('Receiver ok: ' + r.ok.str()) } -fn on_foo(mut receiver Receiver, e &some_module.EventMetadata, sender voidptr) { +fn on_foo(mut receiver Receiver, e &some_module.EventMetadata, _sender voidptr) { receiver.ok = true println('on_foo :: ' + e.message) } -fn on_bar(receiver voidptr, e &some_module.EventMetadata, sender voidptr) { +fn on_bar(_receiver voidptr, e &some_module.EventMetadata, _sender voidptr) { println('on_bar :: ' + e.message) } -fn on_baz(receiver voidptr, event voidptr, d &some_module.Duration) { +fn on_baz(_receiver voidptr, _event voidptr, d &some_module.Duration) { println('on_baz :: ' + d.hours.str()) } diff --git a/examples/gg/cursor.v b/examples/gg/cursor.v index 8ed10be7a..45e42803f 100644 --- a/examples/gg/cursor.v +++ b/examples/gg/cursor.v @@ -13,7 +13,7 @@ fn main() { ctx.run() } -fn init(mut ctx gg.Context) { +fn init(mut _ctx gg.Context) { sapp.set_mouse_cursor(.ibeam) } diff --git a/examples/gg/easing_animation.v b/examples/gg/easing_animation.v index 693382ac3..e51ab7ac9 100644 --- a/examples/gg/easing_animation.v +++ b/examples/gg/easing_animation.v @@ -86,7 +86,7 @@ fn (mut app App) change_functions(direction int) { app.kind = all_keys[idx] } -fn (mut app App) on_event(ev &gg.Event, x voidptr) { +fn (mut app App) on_event(ev &gg.Event, _x voidptr) { if ev.typ != .key_down { return } diff --git a/examples/gg/mandelbrot.v b/examples/gg/mandelbrot.v index 8f76ca719..2de889edd 100644 --- a/examples/gg/mandelbrot.v +++ b/examples/gg/mandelbrot.v @@ -91,7 +91,7 @@ fn (mut state AppState) update() { } @[direct_array_access] -fn (mut state AppState) worker(id int, input chan MandelChunk, ready chan bool) { +fn (mut state AppState) worker(_id int, input chan MandelChunk, ready chan bool) { for { chunk := <-input or { break } yscale := chunk.cview.height() / pheight @@ -168,7 +168,7 @@ fn graphics_click(x f32, y f32, btn gg.MouseButton, mut state AppState) { } } -fn graphics_move(x f32, y f32, mut state AppState) { +fn graphics_move(_x f32, _y f32, mut state AppState) { if state.gg.mouse_buttons.has(.left) { size := gg.window_size() d_x := (f64(state.gg.mouse_dx) / size.width) * state.view.width() @@ -184,7 +184,7 @@ fn graphics_scroll(e &gg.Event, mut state AppState) { state.zoom(if e.scroll_y < 0 { zoom_factor } else { 1 / zoom_factor }) } -fn graphics_keydown(code gg.KeyCode, mod gg.Modifier, mut state AppState) { +fn graphics_keydown(code gg.KeyCode, _mod gg.Modifier, mut state AppState) { s_x := state.view.width() / 5 s_y := state.view.height() / 5 // movement diff --git a/examples/gg/memory.v b/examples/gg/memory.v index ed724c8ff..84e2acbab 100644 --- a/examples/gg/memory.v +++ b/examples/gg/memory.v @@ -39,7 +39,7 @@ fn (mut g Game) restart() { g.card2_idx = none } -fn (mut g Game) draw_cell(i int, cell Cell) { +fn (mut g Game) draw_cell(i int) { x, y := i % g.size, i / g.size rect_x, rect_y := x * csize, header_size + y * csize if g.cells[i].is_open || g.sw.elapsed().milliseconds() <= 1000 { @@ -57,8 +57,8 @@ fn on_frame(mut g Game) { g.ctx.begin() message := '(r)estart (esc)ape | remaining: ${g.remaining:02} | time: ${f64(g.sw.elapsed().milliseconds()) / 1000.0:06.1f}s' g.ctx.draw_text(ws.width / 2, 7, message, color: gg.light_gray, size: 22, align: .center) - for i, cell in g.cells { - g.draw_cell(i, cell) + for i in 0 .. g.cells.len { + g.draw_cell(i) } if g.revert_sw.elapsed().milliseconds() > 750 { g.revert_sw = time.new_stopwatch(auto_start: false) diff --git a/examples/gg/path_finding_algorithm_visualizer/aStar.v b/examples/gg/path_finding_algorithm_visualizer/aStar.v index b3a5a911a..154c5adc6 100644 --- a/examples/gg/path_finding_algorithm_visualizer/aStar.v +++ b/examples/gg/path_finding_algorithm_visualizer/aStar.v @@ -80,10 +80,9 @@ fn main() { height: window_height // window height create_window: true // this will create a different window window_title: 'A* Path finding algorithm visusalizer' // title of the window - frame_fn: frame // this is frame function update the frame - event_fn: on_event // it calls on every event - init_fn: init_images // run at start of application - user_data: app // store user data + frame_fn: frame // this is frame function update the frame + event_fn: on_event // it calls on every event + user_data: app // store user data ) mut grid := initialise_grid() // initialize the grid variable and populate the matrix with each cell as empty app.grid = grid // set grid to app attribute so you can access it by just passing app variable or with method of app @@ -102,17 +101,11 @@ fn main() { // this function will run for every frame actually in a loop fn frame(mut app App) { app.gg.begin() - draw_grid(mut app, mut app.grid) + draw_grid(mut app) draw_gridlines(mut app) app.gg.end() } -// this will run at start of app -fn init_images(mut app App) { - // app.resize() - return -} - // this will handle user event which is stored in gg.event variable fn on_event(event &gg.Event, mut app App) { match event.typ { @@ -192,7 +185,7 @@ fn (mut app App) on_key_down(key gg.KeyCode) { app.gg.quit() } .c { - draw_grid(mut app, mut app.grid) + draw_grid(mut app) draw_gridlines(mut app) mut grid := initialise_grid() app.grid = grid // set grid to app attribute so you can access it by just passing app variable or with method of app @@ -227,15 +220,6 @@ fn hf(p1 Point, p2 Point) int { return math.abs(p1.x - p2.x) + math.abs(p1.y - p2.y) } -// get the position of mouse in terms of which cells' row and column -fn get_clicked_pos(pos Point, rows int, width int) (int, int) { - x := pos.x - y := pos.y - row := y / rows - col := x / rows - return row, col -} - // initialize grid attribute of app fn initialise_grid() [][]Cell { mut grid := [][]Cell{len: nrows, init: []Cell{len: nrows}} @@ -259,7 +243,7 @@ fn initialise_grid() [][]Cell { } // draw the cells of grid -fn draw_grid(mut app App, mut grid [][]Cell) { +fn draw_grid(mut app App) { for i := 0; i < nrows; i++ { for j := 0; j < nrows; j++ { pos := app.grid[i][j].pos @@ -299,7 +283,7 @@ fn update_neighbors(mut grid [][]Cell, row int, col int) { } // construct the path after finding it shows as pink color -fn reconstruct_path(mut grid [][]Cell, mut came_from [][]Point, start Point, end Point) { +fn reconstruct_path(mut grid [][]Cell, mut came_from [][]Point, _start Point, end Point) { mut x := end.x mut y := end.y for !(x == -1 && y == -1) { @@ -310,7 +294,7 @@ fn reconstruct_path(mut grid [][]Cell, mut came_from [][]Point, start Point, end } // a* path finding algorithm -fn astar_path_finding(mut app App, mut grid [][]Cell, start Point, end Point) { +fn astar_path_finding(mut _app App, mut grid [][]Cell, start Point, end Point) { mut priority_queue := &MinHeap{} mut g_score := [][]int{len: nrows, init: []int{len: nrows}} mut f_score := [][]int{len: nrows, init: []int{len: nrows}} diff --git a/examples/hot_reload/tunnel.v b/examples/hot_reload/tunnel.v index f2c3a2d7b..f36c9e50a 100644 --- a/examples/hot_reload/tunnel.v +++ b/examples/hot_reload/tunnel.v @@ -67,7 +67,7 @@ fn init_state() State { return state } -fn (mut state State) on_event(e &gg.Event, ctx voidptr) { +fn (mut state State) on_event(e &gg.Event, _ctx voidptr) { if e.typ == .char { if e.char_code == `f` { gg.toggle_fullscreen() diff --git a/examples/js_dom_draw_benchmark_chart/chart/draw.js.v b/examples/js_dom_draw_benchmark_chart/chart/draw.js.v index 59fd1d9b4..14ddb4b03 100644 --- a/examples/js_dom_draw_benchmark_chart/chart/draw.js.v +++ b/examples/js_dom_draw_benchmark_chart/chart/draw.js.v @@ -15,7 +15,7 @@ fn get_canvas(elem JS.HTMLElement) JS.HTMLCanvasElement { } } -fn draw_line(mut context JS.CanvasRenderingContext2D, x1 int, y1 int, x2 int, y2 int) { +fn draw_line(mut context JS.CanvasRenderingContext2D, _x1 int, _y1 int, _x2 int, _y2 int) { context.beginPath() context.strokeStyle = 'black'.str context.lineWidth = JS.Number(1) diff --git a/examples/jsonrpc/server.v b/examples/jsonrpc/server.v index d544daa4b..d90aa95b2 100644 --- a/examples/jsonrpc/server.v +++ b/examples/jsonrpc/server.v @@ -153,7 +153,7 @@ fn (mut h KvHandler) handle_delete(req &jsonrpc.Request, mut wr jsonrpc.Response }) } -fn (mut h KvHandler) handle_list(req &jsonrpc.Request, mut wr jsonrpc.ResponseWriter) { +fn (mut h KvHandler) handle_list(_req &jsonrpc.Request, mut wr jsonrpc.ResponseWriter) { mut items := []KvItem{} for k, v in h.store.dump() { items << KvItem{ diff --git a/examples/news_fetcher.v b/examples/news_fetcher.v index d6c9afc2e..da1755a19 100644 --- a/examples/news_fetcher.v +++ b/examples/news_fetcher.v @@ -10,7 +10,7 @@ struct Story { url string } -fn worker_fetch(mut p pool.PoolProcessor, cursor int, worker_id int) voidptr { +fn worker_fetch(mut p pool.PoolProcessor, cursor int, _worker_id int) voidptr { id := p.get_item[int](cursor) resp := http.get('https://hacker-news.firebaseio.com/v0/item/${id}.json') or { println('failed to fetch data from /v0/item/${id}.json') diff --git a/examples/path_tracing.v b/examples/path_tracing.v index 081b33b70..f93d01641 100644 --- a/examples/path_tracing.v +++ b/examples/path_tracing.v @@ -473,7 +473,7 @@ fn radiance(r Ray, depthi int, scene_id int) Vec { } //*********************** beam scan routine ********************************* -fn ray_trace(w int, h int, samps int, file_name string, scene_id int) Image { +fn ray_trace(w int, h int, samps int, scene_id int) Image { image := new_image(w, h) // inverse costants @@ -555,17 +555,15 @@ fn main() { // change the seed for a different result rand.seed([u32(2020), 0]) - t1 := time.ticks() - eprintln('Path tracing samples: ${samples}, file_name: ${file_name}, scene_id: ${scene_id}, width: ${width}, height: ${height}') eprintln('') - image := ray_trace(width, height, samples, file_name, scene_id) - t2 := time.ticks() + t1 := time.ticks() + image := ray_trace(width, height, samples, scene_id) + t2 := time.ticks() eprintln('Rendering finished. Took: ${(t2 - t1):5}ms') image.save_as_ppm(file_name) t3 := time.ticks() - eprintln('Image saved as [${file_name}]. Took: ${(t3 - t2):5}ms') } diff --git a/examples/pico/pico.v b/examples/pico/pico.v index a921a4490..b7dbbbd52 100644 --- a/examples/pico/pico.v +++ b/examples/pico/pico.v @@ -22,7 +22,7 @@ fn hello_response() string { return 'Hello, World!' } -fn callback(data voidptr, req picohttpparser.Request, mut res picohttpparser.Response) { +fn callback(_data voidptr, req picohttpparser.Request, mut res picohttpparser.Response) { if req.method == 'GET' { if req.path == '/t' { res.http_ok() diff --git a/examples/pico/raw_callback.v b/examples/pico/raw_callback.v index da9101f24..b01ca2094 100644 --- a/examples/pico/raw_callback.v +++ b/examples/pico/raw_callback.v @@ -17,7 +17,7 @@ fn main() { pico.serve() } -fn handle_conn(mut pv picoev.Picoev, fd int, events int) { +fn handle_conn(mut pv picoev.Picoev, fd int, _events int) { // setup a nonblocking tcp connection mut conn := &net.TcpConn{ sock: net.tcp_socket_from_handle_raw(fd) diff --git a/examples/snek/snek.v b/examples/snek/snek.v index b8ca77e5d..3a9b33262 100644 --- a/examples/snek/snek.v +++ b/examples/snek/snek.v @@ -143,7 +143,7 @@ fn on_frame(mut app App) { } // events -fn on_keydown(key gg.KeyCode, mod gg.Modifier, mut app App) { +fn on_keydown(key gg.KeyCode, _mod gg.Modifier, mut app App) { app.dir_queue << match key { .w, .up { Vec{0, -1} diff --git a/examples/sokol/drawing.v b/examples/sokol/drawing.v index a31d2c41d..5c861f19e 100644 --- a/examples/sokol/drawing.v +++ b/examples/sokol/drawing.v @@ -24,7 +24,7 @@ fn main() { sapp.run(&desc) } -fn init(user_data voidptr) { +fn init(_user_data voidptr) { desc := sapp.create_desc() // gfx.Desc{ gfx.setup(&desc) sgl_desc := sgl.Desc{} diff --git a/examples/ssl_server/server_sni.v b/examples/ssl_server/server_sni.v index 210dc17da..a5af034c3 100644 --- a/examples/ssl_server/server_sni.v +++ b/examples/ssl_server/server_sni.v @@ -14,7 +14,7 @@ import net.mbedtls // certificates, responding to the given domain name in each of the requests. // callback to return the certificates to use for the connection -fn get_cert(mut l mbedtls.SSLListener, host string) !&mbedtls.SSLCerts { +fn get_cert(mut _listener mbedtls.SSLListener, host string) !&mbedtls.SSLCerts { println('reading certificates for ${host} ...') // For our example, just always use the same certificates. In a real server, diff --git a/examples/ssl_server/server_sni_advanced.v b/examples/ssl_server/server_sni_advanced.v index 4a4bdf9e4..7b27ec6cc 100644 --- a/examples/ssl_server/server_sni_advanced.v +++ b/examples/ssl_server/server_sni_advanced.v @@ -26,7 +26,7 @@ mut: certs map[string]&mbedtls.SSLCerts } -fn (mut cm CertManager) get_cert(mut l mbedtls.SSLListener, host string) !&mbedtls.SSLCerts { +fn (mut cm CertManager) get_cert(mut _l mbedtls.SSLListener, host string) !&mbedtls.SSLCerts { println('${host}') if c := cm.certs[host] { diff --git a/examples/veb/middleware/using_middleware.v b/examples/veb/middleware/using_middleware.v index 9dcadbb3e..f620954c8 100644 --- a/examples/veb/middleware/using_middleware.v +++ b/examples/veb/middleware/using_middleware.v @@ -86,22 +86,19 @@ pub fn (mut app App) check_auth() bool { return app.is_authenticated } -fn other_func1(mut ctx vweb.Context) bool { +fn other_func1(mut _ctx vweb.Context) bool { println('1') return true } -fn other_func2(mut ctx vweb.Context) bool { +fn other_func2(mut _ctx vweb.Context) bool { println('2') - - // ... return true } fn middleware_early(mut ctx vweb.Context) bool { println('4') ctx.text(':(') - // returns false, so the middleware propagation is stopped and the user will see the text ":(" return false } diff --git a/vlib/archive/tar/reader.v b/vlib/archive/tar/reader.v index f01c435bc..67b09939e 100644 --- a/vlib/archive/tar/reader.v +++ b/vlib/archive/tar/reader.v @@ -142,7 +142,7 @@ pub fn new_debug_reader() &DebugReader { return &DebugReader{} } -fn (mut t DebugReader) dir_block(mut read Read, size u64) { +fn (mut t DebugReader) dir_block(mut read Read, _size u64) { println('DIR #${read.get_block_number()} ${read.get_path()}') } diff --git a/vlib/datatypes/bstree.v b/vlib/datatypes/bstree.v index 7cae56497..fef4b8ea7 100644 --- a/vlib/datatypes/bstree.v +++ b/vlib/datatypes/bstree.v @@ -46,7 +46,7 @@ fn new_none_node[T](init bool) &BSTreeNode[T] { } // bind to an actual instance of a node. -fn (mut node BSTreeNode[T]) bind(mut to_bind BSTreeNode[T], left bool) { +fn (mut node BSTreeNode[T]) bind(mut to_bind BSTreeNode[T], _left bool) { node.left = to_bind.left node.right = to_bind.right node.value = to_bind.value diff --git a/vlib/net/http/http_proxy.v b/vlib/net/http/http_proxy.v index f7c65f6ed..5530eda61 100644 --- a/vlib/net/http/http_proxy.v +++ b/vlib/net/http/http_proxy.v @@ -91,7 +91,7 @@ fn (pr &HttpProxy) build_proxy_headers(host string) string { return 'CONNECT ${host} ${version}\r\nHost: ${address}\r\n' + uheaders.join('') + '\r\n' } -fn (pr &HttpProxy) http_do(host urllib.URL, method Method, path string, req &Request) !Response { +fn (pr &HttpProxy) http_do(host urllib.URL, _method Method, path string, req &Request) !Response { host_name, port := net.split_address(host.hostname())! port_part := if port == 80 || port == 0 { '' } else { ':${port}' } diff --git a/vlib/net/websocket/websocket_server.v b/vlib/net/websocket/websocket_server.v index aa5db3543..380cb6ff0 100644 --- a/vlib/net/websocket/websocket_server.v +++ b/vlib/net/websocket/websocket_server.v @@ -209,7 +209,7 @@ fn (mut s Server) setup_callbacks(mut sc ServerClient) { sc.client.on_close_ref(delete_client_cb, sc) } -fn delete_client_cb(mut c Client, code int, reason string, mut sc ServerClient) ! { +fn delete_client_cb(mut c Client, _code int, _reason string, mut sc ServerClient) ! { c.logger.debug('server-> Delete client') lock sc.server.server_state { sc.server.server_state.clients.delete(sc.client.id) diff --git a/vlib/picoev/picoev.v b/vlib/picoev/picoev.v index b74714111..5e3e6b76c 100644 --- a/vlib/picoev/picoev.v +++ b/vlib/picoev/picoev.v @@ -176,7 +176,7 @@ fn (mut pv Picoev) handle_timeout() { } // accept_callback accepts a new connection from `listen_fd` and adds it to the event loop. -fn accept_callback(listen_fd int, events int, cb_arg voidptr) { +fn accept_callback(listen_fd int, _events int, cb_arg voidptr) { mut pv := unsafe { &Picoev(cb_arg) } accepted_fd := accept(listen_fd) if accepted_fd == -1 { @@ -293,7 +293,7 @@ fn raw_callback(fd int, events int, context voidptr) { } } -fn default_error_callback(data voidptr, req picohttpparser.Request, mut res picohttpparser.Response, error IError) { +fn default_error_callback(_data voidptr, _req picohttpparser.Request, mut res picohttpparser.Response, error IError) { elog('picoev: ${error}') res.end() } diff --git a/vlib/picohttpparser/picohttpparser.v b/vlib/picohttpparser/picohttpparser.v index 40e58287a..5438b9910 100644 --- a/vlib/picohttpparser/picohttpparser.v +++ b/vlib/picohttpparser/picohttpparser.v @@ -464,7 +464,7 @@ fn advance_token(tok_start &u8, tok_end &u8, mut pret Pret) string { // advance_token2 is a less safe version of advance_token @[inline] -fn advance_token2(tok_start &u8, tok_end &u8, mut pret Pret) string { +fn advance_token2(tok_start &u8, _tok_end &u8, mut pret Pret) string { mut len := 0 mut i := 0 for { diff --git a/vlib/v/preludes/test_runner_normal.v b/vlib/v/preludes/test_runner_normal.v index 8369f07d0..e287bedab 100644 --- a/vlib/v/preludes/test_runner_normal.v +++ b/vlib/v/preludes/test_runner_normal.v @@ -59,7 +59,7 @@ fn normalise_fname(name string) string { return nt3 } -fn (mut runner NormalTestRunner) start(ntests int) { +fn (mut runner NormalTestRunner) start(_ntests int) { unsafe { runner.all_assertsions = []&VAssertMetaInfo{cap: 1000} } @@ -92,7 +92,7 @@ fn (mut runner NormalTestRunner) fn_fail() { runner.fn_fails++ } -fn (mut runner NormalTestRunner) fn_error(line_nr int, file string, mod string, fn_name string, errmsg string) { +fn (mut runner NormalTestRunner) fn_error(line_nr int, file string, _mod string, fn_name string, errmsg string) { filepath := if runner.use_relative_paths { file.clone() } else { os.real_path(file) } mut final_filepath := filepath + ':${line_nr}:' if runner.use_color { diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 4b34eb1aa..f45953153 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -458,7 +458,7 @@ interface MiddlewareInterface { } // Generate route structs for an app -fn generate_routes[T](app &T) !map[string]Route { +fn generate_routes[T](_app &T) !map[string]Route { // Parsing methods attributes mut routes := map[string]Route{} $for method in T.methods { diff --git a/vlib/x/json2/decode.v b/vlib/x/json2/decode.v index 87d9023b4..f9aafc2ad 100644 --- a/vlib/x/json2/decode.v +++ b/vlib/x/json2/decode.v @@ -309,7 +309,7 @@ pub fn decode[T](val string, params DecoderOptions) !T { return result } -fn get_dynamic_from_element[T](t T) []T { +fn get_dynamic_from_element[T](_t T) []T { return []T{} } @@ -830,7 +830,7 @@ fn (mut decoder Decoder) decode_map[K, V](mut val map[K]V) ! { } } -fn create_value_from_optional[T](val ?T) ?T { +fn create_value_from_optional[T](_val ?T) ?T { return T{} } diff --git a/vlib/x/json2/decode_sumtype.v b/vlib/x/json2/decode_sumtype.v index a0400bb43..1aa5da288 100644 --- a/vlib/x/json2/decode_sumtype.v +++ b/vlib/x/json2/decode_sumtype.v @@ -2,7 +2,7 @@ module json2 import time -fn copy_type[T](t T) T { +fn copy_type[T](_t T) T { return T{} } @@ -97,7 +97,7 @@ fn (mut decoder Decoder) check_element_type_valid[T](element T, current_node &No return false } -fn get_array_element_type[T](arr []T) T { +fn get_array_element_type[T](_arr []T) T { return T{} } @@ -118,7 +118,7 @@ fn (mut decoder Decoder) get_array_type_workaround[T](initialized_sumtype T) boo return false } -fn get_map_element_type[U, V](m map[U]V) V { +fn get_map_element_type[U, V](_m map[U]V) V { return V{} } -- 2.39.5