fmt: remove trailing space in comments (#9620)
parent
6d77c8821b
commit
1d5ed89138
|
@ -29,7 +29,7 @@ fn C.GC_REALLOC(ptr voidptr, n size_t) voidptr
|
||||||
fn C.GC_FREE(ptr voidptr)
|
fn C.GC_FREE(ptr voidptr)
|
||||||
|
|
||||||
// explicitely perform garbage collection now! Garbage collections
|
// explicitely perform garbage collection now! Garbage collections
|
||||||
// are done automatically when needed, so this function is hardly needed
|
// are done automatically when needed, so this function is hardly needed
|
||||||
fn C.GC_gcollect()
|
fn C.GC_gcollect()
|
||||||
|
|
||||||
// functions to temporarily suspend/resume garbage collection
|
// functions to temporarily suspend/resume garbage collection
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub fn sym(handle voidptr, symbol string) voidptr {
|
||||||
}
|
}
|
||||||
|
|
||||||
// dlerror provides a text error diagnostic message for functions in `dl`
|
// dlerror provides a text error diagnostic message for functions in `dl`
|
||||||
// it returns a human-readable string, describing the most recent error
|
// it returns a human-readable string, describing the most recent error
|
||||||
// that occurred from a call to one of the `dl` functions, since the last
|
// that occurred from a call to one of the `dl` functions, since the last
|
||||||
// call to dlerror()
|
// call to dlerror()
|
||||||
pub fn dlerror() string {
|
pub fn dlerror() string {
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub fn sym(handle voidptr, symbol string) voidptr {
|
||||||
}
|
}
|
||||||
|
|
||||||
// dlerror provides a text error diagnostic message for functions in `dl`
|
// dlerror provides a text error diagnostic message for functions in `dl`
|
||||||
// it returns a human-readable string, describing the most recent error
|
// it returns a human-readable string, describing the most recent error
|
||||||
// that occurred from a call to one of the `dl` functions, since the last
|
// that occurred from a call to one of the `dl` functions, since the last
|
||||||
// call to dlerror()
|
// call to dlerror()
|
||||||
pub fn dlerror() string {
|
pub fn dlerror() string {
|
||||||
|
|
|
@ -11,7 +11,7 @@ const (
|
||||||
fn testsuite_begin() ? {
|
fn testsuite_begin() ? {
|
||||||
os.rm(test_os_process) or {}
|
os.rm(test_os_process) or {}
|
||||||
if os.getenv('WINE_TEST_OS_PROCESS_EXE') != '' {
|
if os.getenv('WINE_TEST_OS_PROCESS_EXE') != '' {
|
||||||
// Make it easier to run the test under wine emulation, by just
|
// Make it easier to run the test under wine emulation, by just
|
||||||
// prebuilding the executable with:
|
// prebuilding the executable with:
|
||||||
// v -os windows -o x.exe cmd/tools/test_os_process.v
|
// v -os windows -o x.exe cmd/tools/test_os_process.v
|
||||||
// WINE_TEST_OS_PROCESS_EXE=x.exe ./v -os windows vlib/os/process_test.v
|
// WINE_TEST_OS_PROCESS_EXE=x.exe ./v -os windows vlib/os/process_test.v
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub fn (mut f Fmt) comment(node ast.Comment, options CommentsOptions) {
|
||||||
}
|
}
|
||||||
} else if !node.text.contains('\n') {
|
} else if !node.text.contains('\n') {
|
||||||
is_separate_line := !options.inline || node.text.starts_with('\x01')
|
is_separate_line := !options.inline || node.text.starts_with('\x01')
|
||||||
mut s := node.text.trim_left('\x01')
|
mut s := node.text.trim_left('\x01').trim_right(' ')
|
||||||
mut out_s := '//'
|
mut out_s := '//'
|
||||||
if s != '' {
|
if s != '' {
|
||||||
if is_char_alphanumeric(s[0]) {
|
if is_char_alphanumeric(s[0]) {
|
||||||
|
@ -67,7 +67,7 @@ pub fn (mut f Fmt) comment(node ast.Comment, options CommentsOptions) {
|
||||||
f.writeln('')
|
f.writeln('')
|
||||||
}
|
}
|
||||||
for line in lines {
|
for line in lines {
|
||||||
f.writeln(line)
|
f.writeln(line.trim_right(' '))
|
||||||
f.empty_line = false
|
f.empty_line = false
|
||||||
}
|
}
|
||||||
if end_break {
|
if end_break {
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
// NB: The input file has and *should* have trailing spaces.
|
||||||
|
// When making changes, please ensure these spaces are not removed.
|
||||||
|
|
||||||
|
fn comments_with_trailing_space() {
|
||||||
|
// two spaces on the right
|
||||||
|
/*
|
||||||
|
spaces after here
|
||||||
|
and everywhere :)
|
||||||
|
*/
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
// NB: The input file has and *should* have trailing spaces.
|
||||||
|
// When making changes, please ensure these spaces are not removed.
|
||||||
|
|
||||||
|
fn comments_with_trailing_space() {
|
||||||
|
// two spaces on the right
|
||||||
|
/*
|
||||||
|
spaces after here
|
||||||
|
and everywhere :)
|
||||||
|
*/
|
||||||
|
}
|
|
@ -61,15 +61,15 @@ pub fn (mut p Preferences) fill_with_defaults() {
|
||||||
// locate resources relative to it. That enables running examples like
|
// locate resources relative to it. That enables running examples like
|
||||||
// this:
|
// this:
|
||||||
// `./v run examples/flappylearning/`
|
// `./v run examples/flappylearning/`
|
||||||
// instead of:
|
// instead of:
|
||||||
// `./v -o examples/flappylearning/flappylearning run examples/flappylearning/`
|
// `./v -o examples/flappylearning/flappylearning run examples/flappylearning/`
|
||||||
// This topic comes up periodically from time to time on Discord, and
|
// This topic comes up periodically from time to time on Discord, and
|
||||||
// many CI breakages already happened, when someone decides to make V
|
// many CI breakages already happened, when someone decides to make V
|
||||||
// behave in this aspect similarly to the dumb behaviour of other
|
// behave in this aspect similarly to the dumb behaviour of other
|
||||||
// compilers.
|
// compilers.
|
||||||
//
|
//
|
||||||
// If you do decide to break it, please *at the very least*, test it
|
// If you do decide to break it, please *at the very least*, test it
|
||||||
// extensively, and make a PR about it, instead of commiting directly
|
// extensively, and make a PR about it, instead of commiting directly
|
||||||
// and breaking the CI, VC, and users doing `v up`.
|
// and breaking the CI, VC, and users doing `v up`.
|
||||||
if rpath == '$p.vroot/cmd/v' && os.is_dir('vlib/compiler') {
|
if rpath == '$p.vroot/cmd/v' && os.is_dir('vlib/compiler') {
|
||||||
// Building V? Use v2, since we can't overwrite a running
|
// Building V? Use v2, since we can't overwrite a running
|
||||||
|
|
|
@ -24,7 +24,7 @@ fn test_inline_asm() {
|
||||||
mov f, d
|
mov f, d
|
||||||
add f, e
|
add f, e
|
||||||
add f, 5
|
add f, 5
|
||||||
; +r (f) // output
|
; +r (f) // output
|
||||||
; r (d)
|
; r (d)
|
||||||
r (e) // input
|
r (e) // input
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ fn test_inline_asm() {
|
||||||
|
|
||||||
mut j := 0
|
mut j := 0
|
||||||
// do 5*3
|
// do 5*3
|
||||||
// adding three, five times
|
// adding three, five times
|
||||||
asm amd64 {
|
asm amd64 {
|
||||||
mov rcx, 5 // loop 5 times
|
mov rcx, 5 // loop 5 times
|
||||||
loop_start:
|
loop_start:
|
||||||
|
|
|
@ -25,7 +25,7 @@ fn test_inline_asm() {
|
||||||
mov f, d
|
mov f, d
|
||||||
add f, e
|
add f, e
|
||||||
add f, 5
|
add f, 5
|
||||||
; +r (f) // output
|
; +r (f) // output
|
||||||
; r (d)
|
; r (d)
|
||||||
r (e) // input
|
r (e) // input
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ fn sine(note &Note, time f32, amp f32) f32 {
|
||||||
pub fn new_context(cfg Config) fn (&Note, f32, f32) f32 {
|
pub fn new_context(cfg Config) fn (&Note, f32, f32) f32 {
|
||||||
// Note, that here `sine` and `sawtooth`,
|
// Note, that here `sine` and `sawtooth`,
|
||||||
// are different functions, but they do have
|
// are different functions, but they do have
|
||||||
// a compatible signature, so `next_fn` can
|
// a compatible signature, so `next_fn` can
|
||||||
// become either one of them:
|
// become either one of them:
|
||||||
next_fn := match cfg.wave_kind {
|
next_fn := match cfg.wave_kind {
|
||||||
.sine { sine }
|
.sine { sine }
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn (mut p Player) set_name(name string) &Player {
|
||||||
return p // because of automatic (de)reference of return values
|
return p // because of automatic (de)reference of return values
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: `p` is declared as a `mut` parameter,
|
// NB: `p` is declared as a `mut` parameter,
|
||||||
// which now only affects its mutability.
|
// which now only affects its mutability.
|
||||||
fn (mut p Player) set_position(x int, y int) &Player {
|
fn (mut p Player) set_position(x int, y int) &Player {
|
||||||
p.x = x
|
p.x = x
|
||||||
|
|
|
@ -6,7 +6,7 @@ fn test_mod1_can_still_be_found_through_parent_project_vmod() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NB: this main program is under bin/ , but it still
|
NB: this main program is under bin/ , but it still
|
||||||
can find mod1, because the parent project has v.mod,
|
can find mod1, because the parent project has v.mod,
|
||||||
so v module lookup for this program will find mod1 through
|
so v module lookup for this program will find mod1 through
|
||||||
relation to the parent v.mod file
|
relation to the parent v.mod file
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,8 +7,8 @@ println('This script is located inside: ' + resource_abs_path(''))
|
||||||
println('The result of calling m.f is: ' + m.f().str())
|
println('The result of calling m.f is: ' + m.f().str())
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NB: this main program v script is under bin/ ,
|
NB: this main program v script is under bin/ ,
|
||||||
but it *still* can find mod1, because the parent project has v.mod,
|
but it *still* can find mod1, because the parent project has v.mod,
|
||||||
so v module lookup for this bin/main.vsh file will find mod1 through
|
so v module lookup for this bin/main.vsh file will find mod1 through
|
||||||
relation to the parent ../v.mod file
|
relation to the parent ../v.mod file
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@ module submodule
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This submodule just imports its sibling submodules.
|
This submodule just imports its sibling submodules.
|
||||||
Note that they are NOT under 'submodule' itself,
|
Note that they are NOT under 'submodule' itself,
|
||||||
but are in its parent mod1 , and mod1 has a 'v.mod' file.
|
but are in its parent mod1 , and mod1 has a 'v.mod' file.
|
||||||
*/
|
*/
|
||||||
import v.tests.project_with_modules_having_submodules.mod1.mod11
|
import v.tests.project_with_modules_having_submodules.mod1.mod11
|
||||||
|
|
|
@ -572,7 +572,7 @@ fn handle(e Expr) string {
|
||||||
|
|
||||||
// Binary Search Tree test by @SleepyRoy
|
// Binary Search Tree test by @SleepyRoy
|
||||||
// TODO: make Node.value generic once it's robust enough
|
// TODO: make Node.value generic once it's robust enough
|
||||||
// TODO: `return match` instead of returns everywhere inside match
|
// TODO: `return match` instead of returns everywhere inside match
|
||||||
|
|
||||||
struct Empty {}
|
struct Empty {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue