Skip to content

Commit ae6420a

Browse files
committed
tools: fix substring in s usages, preventing v -W build-tools
1 parent f2b73fe commit ae6420a

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

cmd/tools/vdoc/utils.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn trim_doc_node_description(description string) string {
4949
if dn_description.len > 80 {
5050
dn_description = dn_description[..80]
5151
}
52-
if '\n' in dn_description {
52+
if dn_description.contains('\n') {
5353
dn_description = dn_description.split('\n')[0]
5454
}
5555
// 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 {
9999
return true
100100
}
101101
for ignore_path in ignore_paths {
102-
if ignore_path !in path {
102+
if !path.contains(ignore_path) {
103103
continue
104104
}
105105
return false

cmd/tools/vtest-self.v

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,22 @@ fn main() {
220220
mut asan_compiler := false
221221
mut msan_compiler := false
222222
for arg in args {
223-
if '-asan-compiler' in arg {
223+
if arg.contains('-asan-compiler') {
224224
asan_compiler = true
225225
}
226-
if '-msan-compiler' in arg {
226+
if arg.contains('-msan-compiler') {
227227
msan_compiler = true
228228
}
229-
if '-Werror' in arg {
229+
if arg.contains('-Werror') {
230230
werror = true
231231
}
232-
if '-fsanitize=memory' in arg {
232+
if arg.contains('-fsanitize=memory') {
233233
sanitize_memory = true
234234
}
235-
if '-fsanitize=address' in arg {
235+
if arg.contains('-fsanitize=address') {
236236
sanitize_address = true
237237
}
238-
if '-fsanitize=undefined' in arg {
238+
if arg.contains('-fsanitize=undefined') {
239239
sanitize_undefined = true
240240
}
241241
}

vlib/term/ui/termios_nix.c.v

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fn supports_truecolor() bool {
196196
buf[len] = 0
197197
s = tos(buf, len)
198198
}
199-
return '1:2:3' in s
199+
return s.contains('1:2:3')
200200
}
201201

202202
fn termios_reset() {
@@ -296,14 +296,17 @@ fn single_char(buf string) &Event {
296296
utf8: event.utf8
297297
code: KeyCode(96 | ch)
298298
modifiers: .ctrl
299-
} }
300-
65...90 { event = &Event{
299+
}
300+
}
301+
65...90 {
302+
event = &Event{
301303
typ: event.typ
302304
ascii: event.ascii
303305
utf8: event.utf8
304306
code: KeyCode(32 | ch)
305307
modifiers: .shift
306-
} }
308+
}
309+
}
307310
else {}
308311
}
309312

vlib/v/doc/doc.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ pub fn (mut d Doc) generate() ? {
344344
} else {
345345
os.real_path(os.dir(d.base_path))
346346
}
347-
d.is_vlib = 'vlib' !in d.base_path
347+
d.is_vlib = !d.base_path.contains('vlib')
348348
project_files := os.ls(d.base_path) or { return err }
349349
v_files := d.prefs.should_compile_filtered_files(d.base_path, project_files)
350350
if v_files.len == 0 {
@@ -374,7 +374,7 @@ pub fn (mut d Doc) file_asts(file_asts []ast.File) ? {
374374
mut fname_has_set := false
375375
d.orig_mod_name = file_asts[0].mod.name
376376
for i, file_ast in file_asts {
377-
if d.filename.len > 0 && d.filename in file_ast.path && !fname_has_set {
377+
if d.filename.len > 0 && file_ast.path.contains(d.filename) && !fname_has_set {
378378
d.filename = file_ast.path
379379
fname_has_set = true
380380
}

vlib/v/fmt/fmt.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ pub fn (mut f Fmt) if_expr(node ast.IfExpr) {
17671767
cond_len := f.out.len - cur_pos
17681768
is_cond_wrapped := cond_len > 0
17691769
&& (branch.cond is ast.IfGuardExpr || branch.cond is ast.CallExpr)
1770-
&& '\n' in f.out.last_n(cond_len)
1770+
&& f.out.last_n(cond_len).contains('\n')
17711771
if is_cond_wrapped {
17721772
f.writeln('')
17731773
} else {

0 commit comments

Comments
 (0)