tools: fix `substring in s` usages, preventing `v -W build-tools`
parent
f2b73fe3ca
commit
ae6420afc7
|
@ -49,7 +49,7 @@ fn trim_doc_node_description(description string) string {
|
||||||
if dn_description.len > 80 {
|
if dn_description.len > 80 {
|
||||||
dn_description = dn_description[..80]
|
dn_description = dn_description[..80]
|
||||||
}
|
}
|
||||||
if '\n' in dn_description {
|
if dn_description.contains('\n') {
|
||||||
dn_description = dn_description.split('\n')[0]
|
dn_description = dn_description.split('\n')[0]
|
||||||
}
|
}
|
||||||
// if \ is last character, it ends with \" which leads to a JS error
|
// if \ is last character, it ends with \" which leads to a JS error
|
||||||
|
@ -99,7 +99,7 @@ fn is_included(path string, ignore_paths []string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
for ignore_path in ignore_paths {
|
for ignore_path in ignore_paths {
|
||||||
if ignore_path !in path {
|
if !path.contains(ignore_path) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -220,22 +220,22 @@ fn main() {
|
||||||
mut asan_compiler := false
|
mut asan_compiler := false
|
||||||
mut msan_compiler := false
|
mut msan_compiler := false
|
||||||
for arg in args {
|
for arg in args {
|
||||||
if '-asan-compiler' in arg {
|
if arg.contains('-asan-compiler') {
|
||||||
asan_compiler = true
|
asan_compiler = true
|
||||||
}
|
}
|
||||||
if '-msan-compiler' in arg {
|
if arg.contains('-msan-compiler') {
|
||||||
msan_compiler = true
|
msan_compiler = true
|
||||||
}
|
}
|
||||||
if '-Werror' in arg {
|
if arg.contains('-Werror') {
|
||||||
werror = true
|
werror = true
|
||||||
}
|
}
|
||||||
if '-fsanitize=memory' in arg {
|
if arg.contains('-fsanitize=memory') {
|
||||||
sanitize_memory = true
|
sanitize_memory = true
|
||||||
}
|
}
|
||||||
if '-fsanitize=address' in arg {
|
if arg.contains('-fsanitize=address') {
|
||||||
sanitize_address = true
|
sanitize_address = true
|
||||||
}
|
}
|
||||||
if '-fsanitize=undefined' in arg {
|
if arg.contains('-fsanitize=undefined') {
|
||||||
sanitize_undefined = true
|
sanitize_undefined = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ fn supports_truecolor() bool {
|
||||||
buf[len] = 0
|
buf[len] = 0
|
||||||
s = tos(buf, len)
|
s = tos(buf, len)
|
||||||
}
|
}
|
||||||
return '1:2:3' in s
|
return s.contains('1:2:3')
|
||||||
}
|
}
|
||||||
|
|
||||||
fn termios_reset() {
|
fn termios_reset() {
|
||||||
|
@ -296,14 +296,17 @@ fn single_char(buf string) &Event {
|
||||||
utf8: event.utf8
|
utf8: event.utf8
|
||||||
code: KeyCode(96 | ch)
|
code: KeyCode(96 | ch)
|
||||||
modifiers: .ctrl
|
modifiers: .ctrl
|
||||||
} }
|
}
|
||||||
65...90 { event = &Event{
|
}
|
||||||
|
65...90 {
|
||||||
|
event = &Event{
|
||||||
typ: event.typ
|
typ: event.typ
|
||||||
ascii: event.ascii
|
ascii: event.ascii
|
||||||
utf8: event.utf8
|
utf8: event.utf8
|
||||||
code: KeyCode(32 | ch)
|
code: KeyCode(32 | ch)
|
||||||
modifiers: .shift
|
modifiers: .shift
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
else {}
|
else {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ pub fn (mut d Doc) generate() ? {
|
||||||
} else {
|
} else {
|
||||||
os.real_path(os.dir(d.base_path))
|
os.real_path(os.dir(d.base_path))
|
||||||
}
|
}
|
||||||
d.is_vlib = 'vlib' !in d.base_path
|
d.is_vlib = !d.base_path.contains('vlib')
|
||||||
project_files := os.ls(d.base_path) or { return err }
|
project_files := os.ls(d.base_path) or { return err }
|
||||||
v_files := d.prefs.should_compile_filtered_files(d.base_path, project_files)
|
v_files := d.prefs.should_compile_filtered_files(d.base_path, project_files)
|
||||||
if v_files.len == 0 {
|
if v_files.len == 0 {
|
||||||
|
@ -374,7 +374,7 @@ pub fn (mut d Doc) file_asts(file_asts []ast.File) ? {
|
||||||
mut fname_has_set := false
|
mut fname_has_set := false
|
||||||
d.orig_mod_name = file_asts[0].mod.name
|
d.orig_mod_name = file_asts[0].mod.name
|
||||||
for i, file_ast in file_asts {
|
for i, file_ast in file_asts {
|
||||||
if d.filename.len > 0 && d.filename in file_ast.path && !fname_has_set {
|
if d.filename.len > 0 && file_ast.path.contains(d.filename) && !fname_has_set {
|
||||||
d.filename = file_ast.path
|
d.filename = file_ast.path
|
||||||
fname_has_set = true
|
fname_has_set = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1767,7 +1767,7 @@ pub fn (mut f Fmt) if_expr(node ast.IfExpr) {
|
||||||
cond_len := f.out.len - cur_pos
|
cond_len := f.out.len - cur_pos
|
||||||
is_cond_wrapped := cond_len > 0
|
is_cond_wrapped := cond_len > 0
|
||||||
&& (branch.cond is ast.IfGuardExpr || branch.cond is ast.CallExpr)
|
&& (branch.cond is ast.IfGuardExpr || branch.cond is ast.CallExpr)
|
||||||
&& '\n' in f.out.last_n(cond_len)
|
&& f.out.last_n(cond_len).contains('\n')
|
||||||
if is_cond_wrapped {
|
if is_cond_wrapped {
|
||||||
f.writeln('')
|
f.writeln('')
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue