Skip to content

Commit d679146

Browse files
fmt: remove space in front of ? and ! (#14366)
1 parent df029da commit d679146

File tree

324 files changed

+1867
-1881
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

324 files changed

+1867
-1881
lines changed

cmd/tools/check_os_api_parity.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn main() {
4343
vexe := pref.vexe_path()
4444
vroot := os.dir(vexe)
4545
util.set_vroot_folder(vroot)
46-
os.chdir(vroot) ?
46+
os.chdir(vroot)?
4747
cmd := diff.find_working_diff_command() or { '' }
4848
mut app := App{
4949
diff_cmd: cmd

cmd/tools/fast/fast.v

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const vdir = @VEXEROOT
1515
fn main() {
1616
dump(fast_dir)
1717
dump(vdir)
18-
os.chdir(fast_dir) ?
18+
os.chdir(fast_dir)?
1919
if !os.exists('$vdir/v') && !os.is_dir('$vdir/vlib') {
2020
println('fast.html generator needs to be located in `v/cmd/tools/fast`')
2121
}
@@ -32,11 +32,11 @@ fn main() {
3232
// fetch the last commit's hash
3333
commit := exec('git rev-parse HEAD')[..8]
3434
if !os.exists('table.html') {
35-
os.create('table.html') ?
35+
os.create('table.html')?
3636
}
37-
mut table := os.read_file('table.html') ?
37+
mut table := os.read_file('table.html')?
3838
if os.exists('website/index.html') {
39-
uploaded_index := os.read_file('website/index.html') ?
39+
uploaded_index := os.read_file('website/index.html')?
4040
if uploaded_index.contains('>$commit<') {
4141
println('nothing to benchmark')
4242
exit(1)
@@ -48,7 +48,7 @@ fn main() {
4848

4949
// build an optimized V
5050
println(' Building vprod...')
51-
os.chdir(vdir) ?
51+
os.chdir(vdir)?
5252
if os.args.contains('-noprod') {
5353
exec('./v -o vprod cmd/v') // for faster debugging
5454
} else {
@@ -82,8 +82,8 @@ fn main() {
8282
commit_date := exec('git log -n1 --pretty="format:%at" $commit')
8383
date := time.unix(commit_date.int())
8484

85-
os.chdir(fast_dir) ?
86-
mut out := os.create('table.html') ?
85+
os.chdir(fast_dir)?
86+
mut out := os.create('table.html')?
8787

8888
// place the new row on top
8989
html_message := message.replace_each(['<', '&lt;', '>', '&gt;'])
@@ -105,25 +105,25 @@ fn main() {
105105
<td>${int(f64(vlines) / f64(diff1) * 1000.0)}</td>
106106
</tr>\n' +
107107
table.trim_space()
108-
out.writeln(table) ?
108+
out.writeln(table)?
109109
out.close()
110110

111111
// regenerate index.html
112-
header := os.read_file('header.html') ?
113-
footer := os.read_file('footer.html') ?
114-
mut res := os.create('index.html') ?
115-
res.writeln(header) ?
116-
res.writeln(table) ?
117-
res.writeln(footer) ?
112+
header := os.read_file('header.html')?
113+
footer := os.read_file('footer.html')?
114+
mut res := os.create('index.html')?
115+
res.writeln(header)?
116+
res.writeln(table)?
117+
res.writeln(footer)?
118118
res.close()
119119

120120
// upload the result to github pages
121121
if os.args.contains('-upload') {
122122
println('uploading...')
123-
os.chdir('website') ?
123+
os.chdir('website')?
124124
os.execute_or_exit('git checkout gh-pages')
125-
os.cp('../index.html', 'index.html') ?
126-
os.rm('../index.html') ?
125+
os.cp('../index.html', 'index.html')?
126+
os.rm('../index.html')?
127127
os.system('git commit -am "update benchmark"')
128128
os.system('git push origin gh-pages')
129129
}

cmd/tools/oldv.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn main() {
125125
should_sync := fp.bool('cache-sync', `s`, false, 'Update the local cache')
126126
context.is_bisect = fp.bool('bisect', `b`, false, 'Bisect mode. Use the current commit in the repo where oldv is.')
127127
if !should_sync && !context.is_bisect {
128-
fp.limit_free_args(1, 1) ?
128+
fp.limit_free_args(1, 1)?
129129
}
130130
////
131131
context.cleanup = fp.bool('clean', 0, false, 'Clean before running (slower).')

cmd/tools/performance_compare.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ fn main() {
194194
fp.description(tool_description)
195195
fp.arguments_description('COMMIT_BEFORE [COMMIT_AFTER]')
196196
fp.skip_executable()
197-
fp.limit_free_args(1, 2) ?
197+
fp.limit_free_args(1, 2)?
198198
context.vflags = fp.string('vflags', 0, '', 'Additional options to pass to the v commands, for example "-cc tcc"')
199199
context.hyperfineopts = fp.string('hyperfine_options', 0, '', 'Additional options passed to hyperfine.
200200
${flag.space}For example on linux, you may want to pass:

cmd/tools/repeat.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const (
143143

144144
fn main() {
145145
mut context := Context{}
146-
context.parse_options() ?
146+
context.parse_options()?
147147
context.run()
148148
context.show_diff_summary()
149149
}
@@ -155,7 +155,7 @@ fn (mut context Context) parse_options() ? {
155155
fp.description('Repeat command(s) and collect statistics. Note: you have to quote each command, if it contains spaces.')
156156
fp.arguments_description('CMD1 CMD2 ...')
157157
fp.skip_executable()
158-
fp.limit_free_args_to_at_least(1) ?
158+
fp.limit_free_args_to_at_least(1)?
159159
context.count = fp.int('count', `c`, 10, 'Repetition count.')
160160
context.series = fp.int('series', `s`, 2, 'Series count. `-s 2 -c 4 a b` => aaaabbbbaaaabbbb, while `-s 3 -c 2 a b` => aabbaabbaabb.')
161161
context.warmup = fp.int('warmup', `w`, 2, 'Warmup runs. These are done *only at the start*, and are ignored.')

cmd/tools/test_if_v_test_system_works.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn cleanup_tdir() {
4242

4343
fn create_test(tname string, tcontent string) ?string {
4444
tpath := os.join_path(tdir, tname)
45-
os.write_file(tpath, tcontent) ?
45+
os.write_file(tpath, tcontent)?
4646
eprintln('>>>>>>>> tpath: $tpath | tcontent: $tcontent')
4747
return tpath
4848
}
@@ -52,17 +52,17 @@ fn main() {
5252
os.chdir(os.wd_at_startup) or {}
5353
}
5454
println('> vroot: $vroot | vexe: $vexe | tdir: $tdir')
55-
ok_fpath := create_test('a_single_ok_test.v', 'fn test_ok(){ assert true }') ?
55+
ok_fpath := create_test('a_single_ok_test.v', 'fn test_ok(){ assert true }')?
5656
check_ok('"$vexe" "$ok_fpath"')
5757
check_ok('"$vexe" test "$ok_fpath"')
5858
check_ok('"$vexe" test "$tdir"')
59-
fail_fpath := create_test('a_single_failing_test.v', 'fn test_fail(){ assert 1 == 2 }') ?
59+
fail_fpath := create_test('a_single_failing_test.v', 'fn test_fail(){ assert 1 == 2 }')?
6060
check_fail('"$vexe" "$fail_fpath"')
6161
check_fail('"$vexe" test "$fail_fpath"')
6262
check_fail('"$vexe" test "$tdir"')
6363
rel_dir := os.join_path(tdir, rand.ulid())
64-
os.mkdir(rel_dir) ?
65-
os.chdir(rel_dir) ?
64+
os.mkdir(rel_dir)?
65+
os.chdir(rel_dir)?
6666
check_ok('"$vexe" test "..${os.path_separator + os.base(ok_fpath)}"')
6767
println('> all done')
6868
}

cmd/tools/vast/vast.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn main() {
4444
for hf in hfields.split(',') {
4545
ctx.hide_names[hf] = true
4646
}
47-
fp.limit_free_args_to_at_least(1) ?
47+
fp.limit_free_args_to_at_least(1)?
4848
rest_of_args := fp.remaining_parameters()
4949
for vfile in rest_of_args {
5050
file := get_abs_path(vfile)

cmd/tools/vbin2v.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ fn main() {
130130
}
131131
max_bname := context.max_bname_len(file_byte_map.keys())
132132
if context.write_file.len > 0 {
133-
mut out_file := os.create(context.write_file) ?
134-
out_file.write_string(context.header()) ?
133+
mut out_file := os.create(context.write_file)?
134+
out_file.write_string(context.header())?
135135
for bname, fbytes in file_byte_map {
136-
out_file.write_string(context.file2v(bname, fbytes, max_bname)) ?
136+
out_file.write_string(context.file2v(bname, fbytes, max_bname))?
137137
}
138-
out_file.write_string(context.footer()) ?
138+
out_file.write_string(context.footer())?
139139
} else {
140140
print(context.header())
141141
for bname, fbytes in file_byte_map {

cmd/tools/vbuild-tools.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() {
2323
args_string := os.args[1..].join(' ')
2424
vexe := os.getenv('VEXE')
2525
vroot := os.dir(vexe)
26-
os.chdir(vroot) ?
26+
os.chdir(vroot)?
2727
folder := os.join_path('cmd', 'tools')
2828
tfolder := os.join_path(vroot, 'cmd', 'tools')
2929
main_label := 'Building $folder ...'
@@ -47,7 +47,7 @@ fn main() {
4747
exit(1)
4848
}
4949
//
50-
mut executables := os.ls(session.vtmp_dir) ?
50+
mut executables := os.ls(session.vtmp_dir)?
5151
executables.sort()
5252
for texe in executables {
5353
tname := texe.replace(os.file_ext(texe), '')

cmd/tools/vbump.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
tool_version = \'1.2.1\'
2121
version: \'0.2.42\'
2222
VERSION = "1.23.8"
23-
23+
2424
Examples:
2525
Bump the patch version in v.mod if it exists
2626
v bump --patch

cmd/tools/vbump_test.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,21 @@ fn run_individual_test(case BumpTestCase) ? {
6868
test_file := os.join_path_single(temp_dir, case.file_name)
6969

7070
os.rm(test_file) or {}
71-
os.write_file(test_file, case.contents) ?
71+
os.write_file(test_file, case.contents)?
7272
//
7373
os.execute_or_exit('${os.quoted_path(vexe)} bump --patch ${os.quoted_path(test_file)}')
74-
patch_lines := os.read_lines(test_file) ?
74+
patch_lines := os.read_lines(test_file)?
7575
assert patch_lines[case.line] == case.expected_patch
7676

7777
os.execute_or_exit('${os.quoted_path(vexe)} bump --minor ${os.quoted_path(test_file)}')
78-
minor_lines := os.read_lines(test_file) ?
78+
minor_lines := os.read_lines(test_file)?
7979
assert minor_lines[case.line] == case.expected_minor
8080

8181
os.execute_or_exit('${os.quoted_path(vexe)} bump --major ${os.quoted_path(test_file)}')
82-
major_lines := os.read_lines(test_file) ?
82+
major_lines := os.read_lines(test_file)?
8383
assert major_lines[case.line] == case.expected_major
8484
//
85-
os.rm(test_file) ?
85+
os.rm(test_file)?
8686
}
8787

8888
fn test_all_bump_cases() {

cmd/tools/vcreate_test.v

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ const test_path = 'vcreate_test'
55
fn init_and_check() ? {
66
os.execute_or_exit('${os.quoted_path(@VEXE)} init')
77

8-
assert os.read_file('vcreate_test.v') ? == [
8+
assert os.read_file('vcreate_test.v')? == [
99
'module main\n',
1010
'fn main() {',
1111
" println('Hello World!')",
1212
'}',
1313
'',
1414
].join_lines()
1515

16-
assert os.read_file('v.mod') ? == [
16+
assert os.read_file('v.mod')? == [
1717
'Module {',
1818
" name: 'vcreate_test'",
1919
" description: ''",
@@ -24,7 +24,7 @@ fn init_and_check() ? {
2424
'',
2525
].join_lines()
2626

27-
assert os.read_file('.gitignore') ? == [
27+
assert os.read_file('.gitignore')? == [
2828
'# Binaries for programs and plugins',
2929
'main',
3030
'vcreate_test',
@@ -37,15 +37,15 @@ fn init_and_check() ? {
3737
'',
3838
].join_lines()
3939

40-
assert os.read_file('.gitattributes') ? == [
40+
assert os.read_file('.gitattributes')? == [
4141
'*.v linguist-language=V text=auto eol=lf',
4242
'*.vv linguist-language=V text=auto eol=lf',
4343
'*.vsh linguist-language=V text=auto eol=lf',
4444
'**/v.mod linguist-language=V text=auto eol=lf',
4545
'',
4646
].join_lines()
4747

48-
assert os.read_file('.editorconfig') ? == [
48+
assert os.read_file('.editorconfig')? == [
4949
'[*]',
5050
'charset = utf-8',
5151
'end_of_line = lf',
@@ -66,9 +66,9 @@ fn test_v_init() ? {
6666
defer {
6767
os.rmdir_all(dir) or {}
6868
}
69-
os.chdir(dir) ?
69+
os.chdir(dir)?
7070

71-
init_and_check() ?
71+
init_and_check()?
7272
}
7373

7474
fn test_v_init_in_git_dir() ? {
@@ -78,24 +78,24 @@ fn test_v_init_in_git_dir() ? {
7878
defer {
7979
os.rmdir_all(dir) or {}
8080
}
81-
os.chdir(dir) ?
81+
os.chdir(dir)?
8282
os.execute_or_exit('git init .')
83-
init_and_check() ?
83+
init_and_check()?
8484
}
8585

8686
fn test_v_init_no_overwrite_gitignore() ? {
8787
dir := os.join_path(os.temp_dir(), test_path)
8888
os.rmdir_all(dir) or {}
8989
os.mkdir(dir) or {}
90-
os.write_file('$dir/.gitignore', 'blah') ?
90+
os.write_file('$dir/.gitignore', 'blah')?
9191
defer {
9292
os.rmdir_all(dir) or {}
9393
}
94-
os.chdir(dir) ?
94+
os.chdir(dir)?
9595

9696
os.execute_or_exit('${os.quoted_path(@VEXE)} init')
9797

98-
assert os.read_file('.gitignore') ? == 'blah'
98+
assert os.read_file('.gitignore')? == 'blah'
9999
}
100100

101101
fn test_v_init_no_overwrite_gitattributes_and_editorconfig() ? {
@@ -114,15 +114,15 @@ indent_size = 4
114114
dir := os.join_path(os.temp_dir(), test_path)
115115
os.rmdir_all(dir) or {}
116116
os.mkdir(dir) or {}
117-
os.write_file('$dir/.gitattributes', git_attributes_content) ?
118-
os.write_file('$dir/.editorconfig', editor_config_content) ?
117+
os.write_file('$dir/.gitattributes', git_attributes_content)?
118+
os.write_file('$dir/.editorconfig', editor_config_content)?
119119
defer {
120120
os.rmdir_all(dir) or {}
121121
}
122-
os.chdir(dir) ?
122+
os.chdir(dir)?
123123

124124
os.execute_or_exit('${os.quoted_path(@VEXE)} init')
125125

126-
assert os.read_file('.gitattributes') ? == git_attributes_content
127-
assert os.read_file('.editorconfig') ? == editor_config_content
126+
assert os.read_file('.gitattributes')? == git_attributes_content
127+
assert os.read_file('.editorconfig')? == editor_config_content
128128
}

cmd/tools/vdoc/tests/vdoc_file_test.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn find_diff_cmd() string {
1616

1717
fn test_vet() ? {
1818
os.setenv('VCOLORS', 'never', true)
19-
os.chdir(vroot) ?
19+
os.chdir(vroot)?
2020
test_dir := 'cmd/tools/vdoc/tests/testdata'
2121
main_files := get_main_files_in_dir(test_dir)
2222
fails := check_path(vexe, test_dir, main_files)

cmd/tools/vgret.v

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ fn main() {
142142
exit(1)
143143
}
144144

145-
opt.config = new_config(opt.root_path, toml_conf) ?
145+
opt.config = new_config(opt.root_path, toml_conf)?
146146

147147
gen_in_path := arg_paths[0]
148148
if arg_paths.len >= 1 {
149-
generate_screenshots(mut opt, gen_in_path) ?
149+
generate_screenshots(mut opt, gen_in_path)?
150150
}
151151
if arg_paths.len > 1 {
152152
target_path := arg_paths[1]
@@ -199,7 +199,7 @@ fn generate_screenshots(mut opt Options, output_path string) ? {
199199
if opt.verbose {
200200
eprintln('Creating output path `$dst_path`')
201201
}
202-
os.mkdir_all(dst_path) ?
202+
os.mkdir_all(dst_path)?
203203
}
204204

205205
screenshot_path := os.join_path(dst_path, rel_out_path)
@@ -332,7 +332,7 @@ fn take_screenshots(opt Options, app AppConfig) ?[]string {
332332
// ensure_env returns nothing if everything is okay.
333333
fn ensure_env(opt Options) ? {
334334
if !os.exists(tmp_dir) {
335-
os.mkdir_all(tmp_dir) ?
335+
os.mkdir_all(tmp_dir)?
336336
}
337337

338338
if runtime_os !in supported_hosts {
@@ -355,9 +355,9 @@ fn vexe() string {
355355

356356
fn new_config(root_path string, toml_config string) ?Config {
357357
doc := if os.is_file(toml_config) {
358-
toml.parse_file(toml_config) ?
358+
toml.parse_file(toml_config)?
359359
} else {
360-
toml.parse_text(toml_config) ?
360+
toml.parse_text(toml_config)?
361361
}
362362

363363
path := os.real_path(root_path).trim_right('/')

0 commit comments

Comments
 (0)