From cb58db56ef75964d02403adaf5979539969c954c Mon Sep 17 00:00:00 2001 From: yuyi Date: Fri, 16 Aug 2024 17:09:30 +0800 Subject: [PATCH] all: change empty comment to newline (#22053) --- cmd/tools/bench/wyhash.v | 2 +- cmd/tools/changelog_helper.v | 4 +--- cmd/tools/fast/fast.v | 2 +- cmd/tools/modules/testing/common.v | 2 +- cmd/tools/modules/testing/output.v | 4 ++-- cmd/tools/oldv.v | 4 ++-- cmd/tools/regress.v | 2 +- cmd/tools/test_if_v_test_system_works.v | 4 ++-- cmd/tools/vbug.v | 2 +- cmd/tools/vbuild-tools.v | 4 ++-- cmd/tools/vcheck-md.v | 2 +- cmd/tools/vdoctor.v | 6 +++--- cmd/tools/vrepeat.v | 2 +- cmd/tools/vrepl.v | 2 +- cmd/tools/vself.v | 2 +- cmd/tools/vtest-all.v | 6 +++--- cmd/tools/vtest-cleancode.v | 4 ++-- doc/docs.md | 6 +++--- vlib/x/crypto/chacha20poly1305/chacha20poly1305_test.v | 2 +- vlib/x/templating/dtm/tmpl.v | 2 +- 20 files changed, 31 insertions(+), 33 deletions(-) diff --git a/cmd/tools/bench/wyhash.v b/cmd/tools/bench/wyhash.v index bf9831c016..04bc5f6123 100644 --- a/cmd/tools/bench/wyhash.v +++ b/cmd/tools/bench/wyhash.v @@ -24,7 +24,7 @@ fn main() { } bgenerating.measure('generating strings') println('Hashing each of the generated strings...') - // + mut bhashing_1 := benchmark.start() start_pos = 0 checksum = 0 diff --git a/cmd/tools/changelog_helper.v b/cmd/tools/changelog_helper.v index 114112defb..73a1d43aab 100644 --- a/cmd/tools/changelog_helper.v +++ b/cmd/tools/changelog_helper.v @@ -195,9 +195,7 @@ fn (mut app App) process_line(text string) ! { // Always skip docs delete_processed_line_from_log(text)! return - } - // - else { + } else { return } println('process_line: cat=${category} "${text}"') diff --git a/cmd/tools/fast/fast.v b/cmd/tools/fast/fast.v index 221c3c51a0..56f125fa17 100644 --- a/cmd/tools/fast/fast.v +++ b/cmd/tools/fast/fast.v @@ -45,7 +45,7 @@ fn main() { defer { elog('fast.html generator end, total: ${total_sw.elapsed().milliseconds():6} ms') } - // + mut ccompiler_path := 'tcc' if vdir.contains('/tmp/cirrus-ci-build') { ccompiler_path = 'clang' diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index c5aa9064c1..c90fd9e4b7 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -427,7 +427,7 @@ pub fn (mut ts TestSession) test() { ts.reporter.worker_threads_start(remaining_files, mut ts) // all the testing happens here: pool_of_test_runners.work_on_pointers(unsafe { remaining_files.pointers() }) - // + ts.benchmark.stop() ts.append_message(.sentinel, '', MessageThreadContext{ flow_id: '-1' }) // send the sentinel printing_thread.wait() diff --git a/cmd/tools/modules/testing/output.v b/cmd/tools/modules/testing/output.v index 62e733ad2c..de65ce4f67 100644 --- a/cmd/tools/modules/testing/output.v +++ b/cmd/tools/modules/testing/output.v @@ -34,10 +34,10 @@ mut: session_stop(message string, mut ts TestSession) // called once per test session, in the main thread, after everything else, suitable for summaries, creating .xml reports, uploads etc. worker_threads_start(files []string, mut ts TestSession) // called once per test session, in the main thread, right before all the worker threads start worker_threads_finish(mut ts TestSession) // called once per test session, in the main thread, right after all the worker threads finish - // + report(index int, log_msg LogMessage) // called once per each message, that will be shown (ok/fail/skip etc), only in the reporting thread. report_stop() // called just once after all messages are processed, only in the reporting thread, but before stop_session. - // + // TODO: reconsider, whether the next methods, should be kept for all reporters, or just moved inside the normal reporter, to simplify the interface progress(index int, message string) update_last_line(index int, message string) diff --git a/cmd/tools/oldv.v b/cmd/tools/oldv.v index 822888a70f..1b68a73638 100644 --- a/cmd/tools/oldv.v +++ b/cmd/tools/oldv.v @@ -104,12 +104,12 @@ fn sync_cache() { fn main() { scripting.used_tools_must_exist(['git']) - // + // Resetting VEXE here allows for `v run cmd/tools/oldv.v'. // the parent V would have set VEXE, which later will // affect the V's run from the tool itself. os.setenv('VEXE', '', true) - // + mut context := Context{} context.vgo.workdir = cache_oldv_folder mut fp := flag.new_flag_parser(os.args) diff --git a/cmd/tools/regress.v b/cmd/tools/regress.v index 0726fadaba..6b18553032 100644 --- a/cmd/tools/regress.v +++ b/cmd/tools/regress.v @@ -41,7 +41,7 @@ fn main() { To find when a feature was implemented (feature.v should succeed on master): ./v run cmd/tools/regress.v --old a7019ac --command "! ./v run /abs/path/to/feature.v"') fp.skip_executable() - // + context.new_commit = fp.string('new', `n`, 'master', 'The new commit, by default: master.') context.old_commit = fp.string('old', `o`, '', 'A known old commit, required (for it, COMMAND should exit with 0).') context.command = fp.string('command', `c`, '', 'A command to execute. Should exit with 0 for the *old* commits.') diff --git a/cmd/tools/test_if_v_test_system_works.v b/cmd/tools/test_if_v_test_system_works.v index deb41aadd0..0d4f54c4d2 100644 --- a/cmd/tools/test_if_v_test_system_works.v +++ b/cmd/tools/test_if_v_test_system_works.v @@ -118,7 +118,7 @@ fn main() { check_ok('${vexe} test ${ok_fpath}').matches('*OK*a_single_ok_test.v*') check_ok('${vexe} test "${tdir}"').matches('*OK*a_single_ok_test.v*') check_ok('${vexe} -stats test "${tdir}"').matches('*OK*a_single_ok_test.v*') - // + fail_fpath := create_test('a_single_failing_test.v', 'fn test_fail(){ assert 1 == 2 }')! check_fail('${vexe} ${fail_fpath}').has('> assert 1 == 2').has('a_single_failing_test.v:1: fn test_fail') check_fail('${vexe} test ${fail_fpath}').has('> assert 1 == 2').has('a_single_failing_test.v:1: fn test_fail') @@ -129,7 +129,7 @@ fn main() { os.chdir(rel_dir)! relative_path := '..' + os.path_separator + 'a_single_ok_test.v' check_ok('${vexe} test ${os.quoted_path(relative_path)}').has('OK').has('a_single_ok_test.v') - // + check_assert_continues_works()! println('> all done') } diff --git a/cmd/tools/vbug.v b/cmd/tools/vbug.v index 8bc61d838b..b9a234219b 100644 --- a/cmd/tools/vbug.v +++ b/cmd/tools/vbug.v @@ -32,7 +32,7 @@ fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string { } else { eprintln('unable to compile V in debug mode: ${vdbg_result.output}\ncommand: ${vdbg_compilation_cmd}\n') } - // + mut result := os.execute('${os.quoted_path(vexe)} ${verbose_flag} ${os.quoted_path(file_path)}') defer { os.rm(vdbg_path) or { diff --git a/cmd/tools/vbuild-tools.v b/cmd/tools/vbuild-tools.v index cfd3685957..3768eff0a1 100644 --- a/cmd/tools/vbuild-tools.v +++ b/cmd/tools/vbuild-tools.v @@ -30,7 +30,7 @@ fn main() { tfolder := os.join_path(vroot, 'cmd', 'tools') main_label := 'Building ${folder} ...' finish_label := 'building ${folder}' - // + mut skips := []string{} for stool in tools_in_subfolders { skips << os.join_path(tfolder, stool).replace('\\', '/') @@ -49,7 +49,7 @@ fn main() { if session.failed_cmds.len > 0 { exit(1) } - // + mut executables := os.ls(session.vtmp_dir)! executables.sort() for texe in executables { diff --git a/cmd/tools/vcheck-md.v b/cmd/tools/vcheck-md.v index 37211f0e8f..f83ab49365 100644 --- a/cmd/tools/vcheck-md.v +++ b/cmd/tools/vcheck-md.v @@ -169,7 +169,7 @@ mut: examples []VCodeExample current VCodeExample state MDFileParserState = .markdown - // + oks int warnings int errors int // compilation errors + formatting errors diff --git a/cmd/tools/vdoctor.v b/cmd/tools/vdoctor.v index f0d23924da..55b0aa4efb 100644 --- a/cmd/tools/vdoctor.v +++ b/cmd/tools/vdoctor.v @@ -16,7 +16,7 @@ fn (mut a App) println(s string) { fn (mut a App) collect_info() { a.line('V full version', version.full_v_version(true)) - // + mut os_kind := os.user_os() mut arch_details := []string{} arch_details << '${runtime.nr_cpus()} cpus' @@ -54,7 +54,7 @@ fn (mut a App) collect_info() { line: 1 ) } - // + mut os_details := '' wsl_check := a.cmd(command: 'cat /proc/sys/kernel/osrelease') if os_kind == 'linux' { @@ -122,7 +122,7 @@ fn (mut a App) collect_info() { a.line('Git vroot status', a.git_info()) a.line('.git/config present', os.is_file('.git/config').str()) a.println('') - // + a.line('CC version', a.cmd(command: 'cc --version')) a.report_tcc_version('thirdparty/tcc') } diff --git a/cmd/tools/vrepeat.v b/cmd/tools/vrepeat.v index e69c08ff74..345ab26d52 100644 --- a/cmd/tools/vrepeat.v +++ b/cmd/tools/vrepeat.v @@ -92,7 +92,7 @@ fn new_aints(ovals []i64, extreme_mins int, extreme_maxs int) Aints { if vals.len > 0 { res.average = sum / f64(vals.len) } - // + mut devsum := f64(0.0) for i in vals { x := f64(i) - res.average diff --git a/cmd/tools/vrepl.v b/cmd/tools/vrepl.v index 8fa60a9995..5e6a9851ed 100644 --- a/cmd/tools/vrepl.v +++ b/cmd/tools/vrepl.v @@ -22,7 +22,7 @@ mut: is_pin bool // does the repl 'pin' entered source code folder string // the folder in which the repl will write its temporary source files last_output string // the last repl output - // + modules []string // all the import modules alias map[string]string // all the alias used in the import includes []string // all the #include statements diff --git a/cmd/tools/vself.v b/cmd/tools/vself.v index 4d14dbe14e..588907bd51 100644 --- a/cmd/tools/vself.v +++ b/cmd/tools/vself.v @@ -20,7 +20,7 @@ fn main() { } vexe_name := os.file_name(vexe) short_v_name := vexe_name.all_before('.') - // + recompilation.must_be_enabled(vroot, 'Please install V from source, to use `${vexe_name} self` .') os.chdir(vroot)! os.setenv('VCOLORS', 'always', true) diff --git a/cmd/tools/vtest-all.v b/cmd/tools/vtest-all.v index 53cb621dfa..e00b5d1616 100644 --- a/cmd/tools/vtest-all.v +++ b/cmd/tools/vtest-all.v @@ -464,7 +464,7 @@ fn (mut cmd Command) run() { return } } - // + mut is_failed := false mut is_failed_expected := false mut is_failed_starts_with := false @@ -497,10 +497,10 @@ fn (mut cmd Command) run() { is_failed_contains = true } } - // + run_label := if is_failed { term.failed('FAILED') } else { term_highlight('OK') } println('> Running: "${cmd.line}" took: ${spent} ms ... ${run_label}') - // + if is_failed && is_failed_expected { eprintln('> expected:\n${cmd.expect}') eprintln('> output:\n${cmd.output}') diff --git a/cmd/tools/vtest-cleancode.v b/cmd/tools/vtest-cleancode.v index 42afdb27b6..958acce5b2 100644 --- a/cmd/tools/vtest-cleancode.v +++ b/cmd/tools/vtest-cleancode.v @@ -79,7 +79,7 @@ fn v_test_vetting(vargs string) ! { } vet_session := tsession(vargs, 'vvet', '${os.quoted_path(vexe)} vet', 'vet', expanded_vet_list, vet_known_exceptions) - // + fmt_cmd, fmt_args := if is_fix { '${os.quoted_path(vexe)} fmt -w', 'fmt -w' } else { @@ -88,7 +88,7 @@ fn v_test_vetting(vargs string) ! { vfmt_list := util.find_all_v_files(vfmt_verify_list) or { return } exceptions := util.find_all_v_files(vfmt_known_failing_exceptions) or { return } verify_session := tsession(vargs, 'vfmt.v', fmt_cmd, fmt_args, vfmt_list, exceptions) - // + if vet_session.benchmark.nfail > 0 || verify_session.benchmark.nfail > 0 { eprintln('\n') if vet_session.benchmark.nfail > 0 { diff --git a/doc/docs.md b/doc/docs.md index c1e5a0509d..2b04acff05 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -3723,7 +3723,7 @@ struct Dog {} fn main() { cat := Cat{} assert dump(cat.speak()) == 'meow!' - // + a := Adoptable(cat) assert dump(a.speak()) == 'adopt me!' // call Adoptable's `speak` if a is Cat { @@ -3732,7 +3732,7 @@ fn main() { // Cat `speak`, NOT the Adoptable `speak`: dump(a.speak()) // meow! } - // + b := Adoptable(Dog{}) assert dump(b.speak()) == 'adopt me!' // call Adoptable's `speak` // if b is Dog { @@ -7328,7 +7328,7 @@ fn main() { nr_users := C.sqlite3_column_int(stmt, 0) C.sqlite3_finalize(stmt) println('There are ${nr_users} users in the database.') - // + error_msg := &char(0) query_all_users := 'select * from users' rc := C.sqlite3_exec(db, &char(query_all_users.str), my_callback, voidptr(7), &error_msg) diff --git a/vlib/x/crypto/chacha20poly1305/chacha20poly1305_test.v b/vlib/x/crypto/chacha20poly1305/chacha20poly1305_test.v index b5affe152b..ee00232e49 100644 --- a/vlib/x/crypto/chacha20poly1305/chacha20poly1305_test.v +++ b/vlib/x/crypto/chacha20poly1305/chacha20poly1305_test.v @@ -51,7 +51,7 @@ fn test_aead_decrypt_vector_test_51() ! { mut ciphertext_msg := []u8{} ciphertext_msg << ciphertext ciphertext_msg << expected_tag - // + ncsize := nonce.len mut c := new(key, ncsize)! mut cs := chacha20.new_cipher(key, nonce)! diff --git a/vlib/x/templating/dtm/tmpl.v b/vlib/x/templating/dtm/tmpl.v index ed3d066993..f57915f54e 100644 --- a/vlib/x/templating/dtm/tmpl.v +++ b/vlib/x/templating/dtm/tmpl.v @@ -16,7 +16,7 @@ enum State { simple // default - no special interpretation of tags, *at all*! // That is suitable for the general case of text template interpolation, // for example for interpolating arbitrary source code (even V source) templates. - // + html // default, only when the template extension is .html css //