diff --git a/cmd/tools/vdoc/html.v b/cmd/tools/vdoc/html.v
index 92bf83e5ee9403..8fc4dd5b023c6e 100644
--- a/cmd/tools/vdoc/html.v
+++ b/cmd/tools/vdoc/html.v
@@ -169,7 +169,7 @@ fn (vd VDoc) write_content(cn &doc.DocNode, d &doc.Doc, mut hw strings.Builder)
os.file_name(cn.file_path)
}
src_link := get_src_link(vd.manifest.repo_url, file_path_name, cn.pos.line_nr + 1)
- if cn.content.len != 0 || (cn.name == 'Constants') {
+ if cn.content.len != 0 || cn.name == 'Constants' {
hw.write_string(doc_node_html(cn, src_link, false, cfg.include_examples, d.table))
}
for child in cn.children {
diff --git a/cmd/tools/vtest-parser.v b/cmd/tools/vtest-parser.v
index dda8c618a82674..ac2909f139f714 100644
--- a/cmd/tools/vtest-parser.v
+++ b/cmd/tools/vtest-parser.v
@@ -260,7 +260,7 @@ fn (mut context Context) print_status() {
if context.is_silent {
return
}
- if (context.cut_index == 1) && (context.max_index == 0) {
+ if context.cut_index == 1 && context.max_index == 0 {
return
}
msg := '> ${context.path:-30} | index: ${context.cut_index:5}/${context.max_index - 1:5}'
diff --git a/examples/game_of_life/life.v b/examples/game_of_life/life.v
index 037a5303c4a7b6..8e99b1e4187000 100644
--- a/examples/game_of_life/life.v
+++ b/examples/game_of_life/life.v
@@ -37,7 +37,7 @@ fn (mut g Game) evolve() {
temp_grid << []string{}
for y in 0 .. g.grid[x].len {
count := g.get_surrounding_alive_count(x, y)
- if count == 3 || ((g.grid[x][y] == cell) && count == 2) {
+ if count == 3 || (g.grid[x][y] == cell && count == 2) {
temp_grid[x] << cell
} else {
temp_grid[x] << nothing
diff --git a/examples/graphs/bellman-ford.v b/examples/graphs/bellman-ford.v
index 84d9ebd21b35ca..b7df811b5b0474 100644
--- a/examples/graphs/bellman-ford.v
+++ b/examples/graphs/bellman-ford.v
@@ -74,7 +74,7 @@ fn bellman_ford[T](graph [][]T, src int) {
mut u := edges[j].src
mut v := edges[j].dest
mut weight := edges[j].weight
- if (dist[u] != large) && (dist[u] + weight < dist[v]) {
+ if dist[u] != large && dist[u] + weight < dist[v] {
dist[v] = dist[u] + weight
}
}
@@ -88,7 +88,7 @@ fn bellman_ford[T](graph [][]T, src int) {
mut u := edges[j].src
mut v := edges[j].dest
mut weight := edges[j].weight
- if (dist[u] != large) && (dist[u] + weight < dist[v]) {
+ if dist[u] != large && dist[u] + weight < dist[v] {
print('\n Graph contains negative weight cycle')
// If negative cycle is detected, simply
// return or an exit(1)
diff --git a/examples/graphs/bfs2.v b/examples/graphs/bfs2.v
index 6ceeb99f4ebfcf..dc58eb53aaf45e 100644
--- a/examples/graphs/bfs2.v
+++ b/examples/graphs/bfs2.v
@@ -77,7 +77,7 @@ fn build_path_reverse(graph map[string][]string, start string, final string, vis
for (current != start) {
for i in array_of_nodes {
- if (current in graph[i]) && (visited[i] == true) {
+ if current in graph[i] && visited[i] == true {
current = i
break // the first ocurrence is enough
}
diff --git a/examples/graphs/dfs.v b/examples/graphs/dfs.v
index b12c570b9cde76..1d64dd11228eb6 100644
--- a/examples/graphs/dfs.v
+++ b/examples/graphs/dfs.v
@@ -91,7 +91,7 @@ fn build_path_reverse(graph map[string][]string, start string, final string, vis
for current != start {
for i in array_of_nodes {
- if (current in graph[i]) && (visited[i] == true) {
+ if current in graph[i] && visited[i] == true {
current = i
break // the first ocurrence is enough
}
diff --git a/examples/graphs/dijkstra.v b/examples/graphs/dijkstra.v
index 79454e44898727..a930f887b438a6 100644
--- a/examples/graphs/dijkstra.v
+++ b/examples/graphs/dijkstra.v
@@ -41,7 +41,7 @@ fn push_pq[T](mut prior_queue []T, data int, priority int) {
lenght_pq := prior_queue.len
mut i := 0
- for (i < lenght_pq) && (priority > prior_queue[i].priority) {
+ for i < lenght_pq && priority > prior_queue[i].priority {
temp << prior_queue[i]
i++
}
diff --git a/examples/graphs/minimal_spann_tree_prim.v b/examples/graphs/minimal_spann_tree_prim.v
index ee40546c52592f..3bb46ba6629c57 100644
--- a/examples/graphs/minimal_spann_tree_prim.v
+++ b/examples/graphs/minimal_spann_tree_prim.v
@@ -35,7 +35,7 @@ fn push_pq[T](mut prior_queue []T, data int, priority int) {
lenght_pq := prior_queue.len
mut i := 0
- for (i < lenght_pq) && (priority > prior_queue[i].priority) {
+ for i < lenght_pq && priority > prior_queue[i].priority {
temp << prior_queue[i]
i++
}
diff --git a/vlib/builtin/js/string_test.js.v b/vlib/builtin/js/string_test.js.v
index 8963ca0dbba623..d935b2d82fa418 100644
--- a/vlib/builtin/js/string_test.js.v
+++ b/vlib/builtin/js/string_test.js.v
@@ -831,7 +831,7 @@ fn test_split_into_lines() {
assert lines_mixed_trailers.len == 9
for line in lines_mixed_trailers {
- assert (line == line_content) || (line == '')
+ assert line == line_content || line == ''
}
}
diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v
index ba67c563595401..de28aa45d3cd02 100644
--- a/vlib/builtin/string.v
+++ b/vlib/builtin/string.v
@@ -1019,7 +1019,7 @@ pub fn (s string) split_into_lines() []string {
line_start = i + 1
} else if s[i] == cr {
res << if line_start == i { '' } else { s[line_start..i] }
- if ((i + 1) < s.len) && (s[i + 1] == lf) {
+ if (i + 1) < s.len && s[i + 1] == lf {
line_start = i + 2
} else {
line_start = i + 1
@@ -1796,7 +1796,7 @@ fn (s string) at_with_check(idx int) ?u8 {
pub fn (c u8) is_space() bool {
// 0x85 is NEXT LINE (NEL)
// 0xa0 is NO-BREAK SPACE
- return c == 32 || (c > 8 && c < 14) || (c == 0x85) || (c == 0xa0)
+ return c == 32 || (c > 8 && c < 14) || c == 0x85 || c == 0xa0
}
// is_digit returns `true` if the byte is in range 0-9 and `false` otherwise.
diff --git a/vlib/builtin/string_test.v b/vlib/builtin/string_test.v
index 0dbe2552246bf2..d17f40fec883c0 100644
--- a/vlib/builtin/string_test.v
+++ b/vlib/builtin/string_test.v
@@ -1054,7 +1054,7 @@ fn test_split_into_lines() {
assert lines_mixed_trailers.len == 9
for line in lines_mixed_trailers {
- assert (line == line_content) || (line == '')
+ assert line == line_content || line == ''
}
}
diff --git a/vlib/datatypes/quadtree.v b/vlib/datatypes/quadtree.v
index a40c4529421b5a..3d4587878fb7d2 100644
--- a/vlib/datatypes/quadtree.v
+++ b/vlib/datatypes/quadtree.v
@@ -49,7 +49,7 @@ pub fn (mut q Quadtree) insert(p AABB) {
q.particles << p
- if (q.particles.len > q.capacity) && (q.level < q.depth) {
+ if q.particles.len > q.capacity && q.level < q.depth {
if q.nodes.len == 0 {
q.split()
}
diff --git a/vlib/encoding/csv/writer.v b/vlib/encoding/csv/writer.v
index 4f72884afecc82..86ed59bf43aa64 100644
--- a/vlib/encoding/csv/writer.v
+++ b/vlib/encoding/csv/writer.v
@@ -76,7 +76,7 @@ fn (w &Writer) field_needs_quotes(field string) bool {
if field == '' {
return false
}
- if field.contains(w.delimiter.ascii_str()) || (field.index_any('"\r\n') != -1) {
+ if field.contains(w.delimiter.ascii_str()) || field.index_any('"\r\n') != -1 {
return true
}
return false
diff --git a/vlib/encoding/utf8/utf8_util.v b/vlib/encoding/utf8/utf8_util.v
index 5960ca199ac23d..3e2567ee6e6e8d 100644
--- a/vlib/encoding/utf8/utf8_util.v
+++ b/vlib/encoding/utf8/utf8_util.v
@@ -212,42 +212,41 @@ Private functions
// Raw to_lower utf-8 function
fn utf8_to_lower(in_cp int) int {
mut cp := in_cp
- if ((0x0041 <= cp) && (0x005a >= cp)) || ((0x00c0 <= cp) && (0x00d6 >= cp))
- || ((0x00d8 <= cp) && (0x00de >= cp)) || ((0x0391 <= cp) && (0x03a1 >= cp))
- || ((0x03a3 <= cp) && (0x03ab >= cp)) || ((0x0410 <= cp) && (0x042f >= cp)) {
+ if (0x0041 <= cp && 0x005a >= cp) || (0x00c0 <= cp && 0x00d6 >= cp)
+ || (0x00d8 <= cp && 0x00de >= cp) || (0x0391 <= cp && 0x03a1 >= cp)
+ || (0x03a3 <= cp && 0x03ab >= cp) || (0x0410 <= cp && 0x042f >= cp) {
cp += 32
- } else if (0x0400 <= cp) && (0x040f >= cp) {
+ } else if 0x0400 <= cp && 0x040f >= cp {
cp += 80
- } else if ((0x0100 <= cp) && (0x012f >= cp)) || ((0x0132 <= cp) && (0x0137 >= cp))
- || ((0x014a <= cp) && (0x0177 >= cp)) || ((0x0182 <= cp) && (0x0185 >= cp))
- || ((0x01a0 <= cp) && (0x01a5 >= cp)) || ((0x01de <= cp) && (0x01ef >= cp))
- || ((0x01f8 <= cp) && (0x021f >= cp)) || ((0x0222 <= cp) && (0x0233 >= cp))
- || ((0x0246 <= cp) && (0x024f >= cp)) || ((0x03d8 <= cp) && (0x03ef >= cp))
- || ((0x0460 <= cp) && (0x0481 >= cp)) || ((0x048a <= cp) && (0x04ff >= cp)) {
+ } else if (0x0100 <= cp && 0x012f >= cp) || (0x0132 <= cp && 0x0137 >= cp)
+ || (0x014a <= cp && 0x0177 >= cp) || (0x0182 <= cp && 0x0185 >= cp)
+ || (0x01a0 <= cp && 0x01a5 >= cp) || (0x01de <= cp && 0x01ef >= cp)
+ || (0x01f8 <= cp && 0x021f >= cp) || (0x0222 <= cp && 0x0233 >= cp)
+ || (0x0246 <= cp && 0x024f >= cp) || (0x03d8 <= cp && 0x03ef >= cp)
+ || (0x0460 <= cp && 0x0481 >= cp) || (0x048a <= cp && 0x04ff >= cp) {
cp |= 0x1
- } else if ((0x0139 <= cp) && (0x0148 >= cp)) || ((0x0179 <= cp) && (0x017e >= cp))
- || ((0x01af <= cp) && (0x01b0 >= cp)) || ((0x01b3 <= cp) && (0x01b6 >= cp))
- || ((0x01cd <= cp) && (0x01dc >= cp)) {
+ } else if (0x0139 <= cp && 0x0148 >= cp) || (0x0179 <= cp && 0x017e >= cp)
+ || (0x01af <= cp && 0x01b0 >= cp) || (0x01b3 <= cp && 0x01b6 >= cp)
+ || (0x01cd <= cp && 0x01dc >= cp) {
cp += 1
cp &= ~0x1
- } else if ((0x0531 <= cp) && (0x0556 >= cp)) || ((0x10A0 <= cp) && (0x10C5 >= cp)) {
+ } else if (0x0531 <= cp && 0x0556 >= cp) || (0x10A0 <= cp && 0x10C5 >= cp) {
// ARMENIAN or GEORGIAN
cp += 0x30
- } else if (((0x1E00 <= cp) && (0x1E94 >= cp)) || ((0x1EA0 <= cp) && (0x1EF8 >= cp)))
- && (cp & 1 == 0) {
+ } else if ((0x1E00 <= cp && 0x1E94 >= cp) || (0x1EA0 <= cp && 0x1EF8 >= cp)) && cp & 1 == 0 {
// LATIN CAPITAL LETTER
cp += 1
- } else if (0x24B6 <= cp) && (0x24CF >= cp) {
+ } else if 0x24B6 <= cp && 0x24CF >= cp {
// CIRCLED LATIN
cp += 0x1a
- } else if (0xFF21 <= cp) && (0xFF3A >= cp) {
+ } else if 0xFF21 <= cp && 0xFF3A >= cp {
// FULLWIDTH LATIN CAPITAL
cp += 0x19
- } else if ((0x1F08 <= cp) && (0x1F0F >= cp)) || ((0x1F18 <= cp) && (0x1F1D >= cp))
- || ((0x1F28 <= cp) && (0x1F2F >= cp)) || ((0x1F38 <= cp) && (0x1F3F >= cp))
- || ((0x1F48 <= cp) && (0x1F4D >= cp)) || ((0x1F68 <= cp) && (0x1F6F >= cp))
- || ((0x1F88 <= cp) && (0x1F8F >= cp)) || ((0x1F98 <= cp) && (0x1F9F >= cp))
- || ((0x1FA8 <= cp) && (0x1FAF >= cp)) {
+ } else if (0x1F08 <= cp && 0x1F0F >= cp) || (0x1F18 <= cp && 0x1F1D >= cp)
+ || (0x1F28 <= cp && 0x1F2F >= cp) || (0x1F38 <= cp && 0x1F3F >= cp)
+ || (0x1F48 <= cp && 0x1F4D >= cp) || (0x1F68 <= cp && 0x1F6F >= cp)
+ || (0x1F88 <= cp && 0x1F8F >= cp) || (0x1F98 <= cp && 0x1F9F >= cp)
+ || (0x1FA8 <= cp && 0x1FAF >= cp) {
// GREEK
cp -= 8
} else {
@@ -315,42 +314,41 @@ fn utf8_to_lower(in_cp int) int {
// Raw to_upper utf-8 function
fn utf8_to_upper(in_cp int) int {
mut cp := in_cp
- if ((0x0061 <= cp) && (0x007a >= cp)) || ((0x00e0 <= cp) && (0x00f6 >= cp))
- || ((0x00f8 <= cp) && (0x00fe >= cp)) || ((0x03b1 <= cp) && (0x03c1 >= cp))
- || ((0x03c3 <= cp) && (0x03cb >= cp)) || ((0x0430 <= cp) && (0x044f >= cp)) {
+ if (0x0061 <= cp && 0x007a >= cp) || (0x00e0 <= cp && 0x00f6 >= cp)
+ || (0x00f8 <= cp && 0x00fe >= cp) || (0x03b1 <= cp && 0x03c1 >= cp)
+ || (0x03c3 <= cp && 0x03cb >= cp) || (0x0430 <= cp && 0x044f >= cp) {
cp -= 32
- } else if (0x0450 <= cp) && (0x045f >= cp) {
+ } else if 0x0450 <= cp && 0x045f >= cp {
cp -= 80
- } else if ((0x0100 <= cp) && (0x012f >= cp)) || ((0x0132 <= cp) && (0x0137 >= cp))
- || ((0x014a <= cp) && (0x0177 >= cp)) || ((0x0182 <= cp) && (0x0185 >= cp))
- || ((0x01a0 <= cp) && (0x01a5 >= cp)) || ((0x01de <= cp) && (0x01ef >= cp))
- || ((0x01f8 <= cp) && (0x021f >= cp)) || ((0x0222 <= cp) && (0x0233 >= cp))
- || ((0x0246 <= cp) && (0x024f >= cp)) || ((0x03d8 <= cp) && (0x03ef >= cp))
- || ((0x0460 <= cp) && (0x0481 >= cp)) || ((0x048a <= cp) && (0x04ff >= cp)) {
+ } else if (0x0100 <= cp && 0x012f >= cp) || (0x0132 <= cp && 0x0137 >= cp)
+ || (0x014a <= cp && 0x0177 >= cp) || (0x0182 <= cp && 0x0185 >= cp)
+ || (0x01a0 <= cp && 0x01a5 >= cp) || (0x01de <= cp && 0x01ef >= cp)
+ || (0x01f8 <= cp && 0x021f >= cp) || (0x0222 <= cp && 0x0233 >= cp)
+ || (0x0246 <= cp && 0x024f >= cp) || (0x03d8 <= cp && 0x03ef >= cp)
+ || (0x0460 <= cp && 0x0481 >= cp) || (0x048a <= cp && 0x04ff >= cp) {
cp &= ~0x1
- } else if ((0x0139 <= cp) && (0x0148 >= cp)) || ((0x0179 <= cp) && (0x017e >= cp))
- || ((0x01af <= cp) && (0x01b0 >= cp)) || ((0x01b3 <= cp) && (0x01b6 >= cp))
- || ((0x01cd <= cp) && (0x01dc >= cp)) {
+ } else if (0x0139 <= cp && 0x0148 >= cp) || (0x0179 <= cp && 0x017e >= cp)
+ || (0x01af <= cp && 0x01b0 >= cp) || (0x01b3 <= cp && 0x01b6 >= cp)
+ || (0x01cd <= cp && 0x01dc >= cp) {
cp -= 1
cp |= 0x1
- } else if ((0x0561 <= cp) && (0x0586 >= cp)) || ((0x10D0 <= cp) && (0x10F5 >= cp)) {
+ } else if (0x0561 <= cp && 0x0586 >= cp) || (0x10D0 <= cp && 0x10F5 >= cp) {
// ARMENIAN or GEORGIAN
cp -= 0x30
- } else if (((0x1E01 <= cp) && (0x1E95 >= cp)) || ((0x1EA1 <= cp) && (0x1EF9 >= cp)))
- && (cp & 1 == 1) {
+ } else if ((0x1E01 <= cp && 0x1E95 >= cp) || (0x1EA1 <= cp && 0x1EF9 >= cp)) && cp & 1 == 1 {
// LATIN CAPITAL LETTER
cp -= 1
- } else if (0x24D0 <= cp) && (0x24E9 >= cp) {
+ } else if 0x24D0 <= cp && 0x24E9 >= cp {
// CIRCLED LATIN
cp -= 0x1a
- } else if (0xFF41 <= cp) && (0xFF5A >= cp) {
+ } else if 0xFF41 <= cp && 0xFF5A >= cp {
// FULLWIDTH LATIN CAPITAL
cp -= 0x19
- } else if ((0x1F00 <= cp) && (0x1F07 >= cp)) || ((0x1F10 <= cp) && (0x1F15 >= cp))
- || ((0x1F20 <= cp) && (0x1F27 >= cp)) || ((0x1F30 <= cp) && (0x1F37 >= cp))
- || ((0x1F40 <= cp) && (0x1F45 >= cp)) || ((0x1F60 <= cp) && (0x1F67 >= cp))
- || ((0x1F80 <= cp) && (0x1F87 >= cp)) || ((0x1F90 <= cp) && (0x1F97 >= cp))
- || ((0x1FA0 <= cp) && (0x1FA7 >= cp)) {
+ } else if (0x1F00 <= cp && 0x1F07 >= cp) || (0x1F10 <= cp && 0x1F15 >= cp)
+ || (0x1F20 <= cp && 0x1F27 >= cp) || (0x1F30 <= cp && 0x1F37 >= cp)
+ || (0x1F40 <= cp && 0x1F45 >= cp) || (0x1F60 <= cp && 0x1F67 >= cp)
+ || (0x1F80 <= cp && 0x1F87 >= cp) || (0x1F90 <= cp && 0x1F97 >= cp)
+ || (0x1FA0 <= cp && 0x1FA7 >= cp) {
// GREEK
cp += 8
} else {
diff --git a/vlib/flag/flag.v b/vlib/flag/flag.v
index 22b85009cb67b8..b759ea3a027da1 100644
--- a/vlib/flag/flag.v
+++ b/vlib/flag/flag.v
@@ -289,7 +289,7 @@ fn (mut fs FlagParser) parse_bool_value(longhand string, shorthand u8) !string {
continue
}
if (arg.len == 2 && arg[0] == `-` && arg[1] == shorthand) || arg == full {
- if fs.args.len > i + 1 && (fs.args[i + 1] in ['true', 'false']) {
+ if fs.args.len > i + 1 && fs.args[i + 1] in ['true', 'false'] {
val := fs.args[i + 1]
fs.args.delete(i + 1)
fs.args.delete(i)
diff --git a/vlib/math/bits/bits.v b/vlib/math/bits/bits.v
index e1ce4db079302a..3e3db9ebe0f6a3 100644
--- a/vlib/math/bits/bits.v
+++ b/vlib/math/bits/bits.v
@@ -456,7 +456,7 @@ pub fn div_64(hi u64, lo u64, y1 u64) (u64, u64) {
un0 := un10 & bits.mask32
mut q1 := un32 / yn1
mut rhat := un32 - (q1 * yn1)
- for (q1 >= bits.two32) || (q1 * yn0) > ((bits.two32 * rhat) + un1) {
+ for q1 >= bits.two32 || (q1 * yn0) > ((bits.two32 * rhat) + un1) {
q1--
rhat += yn1
if rhat >= bits.two32 {
@@ -466,7 +466,7 @@ pub fn div_64(hi u64, lo u64, y1 u64) (u64, u64) {
un21 := (un32 * bits.two32) + (un1 - (q1 * y))
mut q0 := un21 / yn1
rhat = un21 - q0 * yn1
- for (q0 >= bits.two32) || (q0 * yn0) > ((bits.two32 * rhat) + un0) {
+ for q0 >= bits.two32 || (q0 * yn0) > ((bits.two32 * rhat) + un0) {
q0--
rhat += yn1
if rhat >= bits.two32 {
diff --git a/vlib/math/complex/complex.v b/vlib/math/complex/complex.v
index 92cfd4f9535a6b..a2efbceda5d5d8 100644
--- a/vlib/math/complex/complex.v
+++ b/vlib/math/complex/complex.v
@@ -370,5 +370,5 @@ pub fn (c Complex) acsch() Complex {
// Complex Equals
pub fn (c1 Complex) equals(c2 Complex) bool {
- return (c1.re == c2.re) && (c1.im == c2.im)
+ return c1.re == c2.re && c1.im == c2.im
}
diff --git a/vlib/math/invtrig.v b/vlib/math/invtrig.v
index f49dd43be6cbb8..80a9a06f3912a3 100644
--- a/vlib/math/invtrig.v
+++ b/vlib/math/invtrig.v
@@ -203,7 +203,7 @@ pub fn asin(x_ f64) f64 {
// acos(x) = nan if x < -1 or x > 1
[inline]
pub fn acos(x f64) f64 {
- if (x < -1.0) || (x > 1.0) {
+ if x < -1.0 || x > 1.0 {
return nan()
}
if x > 0.5 {
diff --git a/vlib/regex/regex.v b/vlib/regex/regex.v
index 49f8e614b023db..10c7aecd057a0a 100644
--- a/vlib/regex/regex.v
+++ b/vlib/regex/regex.v
@@ -1982,7 +1982,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) {
// check if stop
else if m_state == .stop {
// we are in search mode, don't exit until the end
- if ((re.flag & regex.f_src) != 0) && (ist != regex.ist_prog_end) {
+ if (re.flag & regex.f_src) != 0 && ist != regex.ist_prog_end {
last_fnd_pc = state.pc
state.pc = -1
state.i += char_len
diff --git a/vlib/regex/regex_test.v b/vlib/regex/regex_test.v
index abc5e91a11549d..f96c0287fb4aa1 100644
--- a/vlib/regex/regex_test.v
+++ b/vlib/regex/regex_test.v
@@ -691,7 +691,7 @@ fn test_regex_func() {
mut re, re_err, err_pos := regex.regex_base(query)
if re_err == regex.compile_ok {
start, end := re.match_string(test_str)
- assert (start == 0) && (end == 6)
+ assert start == 0 && end == 6
} else {
eprintln('Error in query string in pos ${err_pos}')
eprintln('Error: ${re.get_parse_error_string(re_err)}')
diff --git a/vlib/strconv/atof.c.v b/vlib/strconv/atof.c.v
index 9ad6e00f9d342f..4f2fd63c39989e 100644
--- a/vlib/strconv/atof.c.v
+++ b/vlib/strconv/atof.c.v
@@ -163,7 +163,7 @@ fn parser(s string) (ParserState, PrepNumber) {
}
// read mantissa decimals
- if (i < s.len) && (s[i] == `.`) {
+ if i < s.len && s[i] == `.` {
i++
for i < s.len && s[i].is_digit() {
if digx < strconv.digits {
@@ -177,7 +177,7 @@ fn parser(s string) (ParserState, PrepNumber) {
}
// read exponent
- if (i < s.len) && ((s[i] == `e`) || (s[i] == `E`)) {
+ if i < s.len && (s[i] == `e` || s[i] == `E`) {
i++
if i < s.len {
// esponent sign
diff --git a/vlib/strconv/atoi.v b/vlib/strconv/atoi.v
index 5d197b50dcec5d..a2fa6eb7fffd8c 100644
--- a/vlib/strconv/atoi.v
+++ b/vlib/strconv/atoi.v
@@ -233,8 +233,8 @@ fn underscore_ok(s string) bool {
}
// Optional base prefix.
mut hex := false
- if (s.len - i >= 2) && (s[i] == `0`) && (((s[i + 1] | 32) == `b`)
- || ((s[i + 1] | 32) == `o`) || ((s[i + 1] | 32) == `x`)) {
+ if s.len - i >= 2 && s[i] == `0` && ((s[i + 1] | 32) == `b`
+ || (s[i + 1] | 32) == `o` || (s[i + 1] | 32) == `x`) {
saw = `0` // base prefix counts as a digit for "underscore as digit separator"
hex = (s[i + 1] | 32) == `x`
i += 2
@@ -242,7 +242,7 @@ fn underscore_ok(s string) bool {
// Number proper.
for ; i < s.len; i++ {
// Digits are always okay.
- if (`0` <= s[i] && s[i] <= `9`) || ((hex && `a` <= (s[i] | 32)) && ((s[i] | 32) <= `f`)) {
+ if (`0` <= s[i] && s[i] <= `9`) || ((hex && `a` <= (s[i] | 32)) && (s[i] | 32) <= `f`) {
saw = `0`
continue
}
diff --git a/vlib/strconv/f32_str.c.v b/vlib/strconv/f32_str.c.v
index 942cae2a9023cf..84bed43f0f1430 100644
--- a/vlib/strconv/f32_str.c.v
+++ b/vlib/strconv/f32_str.c.v
@@ -269,7 +269,7 @@ fn f32_to_decimal(mant u32, exp u32) Dec32 {
// General case, which happens rarely (~4.0%).
for vp / 10 > vm / 10 {
vm_is_trailing_zeros = vm_is_trailing_zeros && (vm % 10) == 0
- vr_is_trailing_zeros = vr_is_trailing_zeros && (last_removed_digit == 0)
+ vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0
last_removed_digit = u8(vr % 10)
vr /= 10
vp /= 10
@@ -278,7 +278,7 @@ fn f32_to_decimal(mant u32, exp u32) Dec32 {
}
if vm_is_trailing_zeros {
for vm % 10 == 0 {
- vr_is_trailing_zeros = vr_is_trailing_zeros && (last_removed_digit == 0)
+ vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0
last_removed_digit = u8(vr % 10)
vr /= 10
vp /= 10
@@ -286,7 +286,7 @@ fn f32_to_decimal(mant u32, exp u32) Dec32 {
removed++
}
}
- if vr_is_trailing_zeros && (last_removed_digit == 5) && (vr % 2) == 0 {
+ if vr_is_trailing_zeros && last_removed_digit == 5 && (vr % 2) == 0 {
// Round even if the exact number is .....50..0.
last_removed_digit = 4
}
@@ -335,7 +335,7 @@ pub fn f32_to_str(f f32, n_digit int) string {
// println("${neg} ${mant} e ${exp-bias32}")
// Exit early for easy cases.
- if (exp == strconv.maxexp32) || (exp == 0 && mant == 0) {
+ if exp == strconv.maxexp32 || (exp == 0 && mant == 0) {
return get_string_special(neg, exp == 0, mant == 0)
}
@@ -362,7 +362,7 @@ pub fn f32_to_str_pad(f f32, n_digit int) string {
// println("${neg} ${mant} e ${exp-bias32}")
// Exit early for easy cases.
- if (exp == strconv.maxexp32) || (exp == 0 && mant == 0) {
+ if exp == strconv.maxexp32 || (exp == 0 && mant == 0) {
return get_string_special(neg, exp == 0, mant == 0)
}
diff --git a/vlib/strconv/f64_str.c.v b/vlib/strconv/f64_str.c.v
index 85025de98e5cb2..9b3769f87cccea 100644
--- a/vlib/strconv/f64_str.c.v
+++ b/vlib/strconv/f64_str.c.v
@@ -258,7 +258,7 @@ fn f64_to_decimal(mant u64, exp u64) Dec64 {
vr_div_10 := vr / 10
vr_mod_10 := vr % 10
vm_is_trailing_zeros = vm_is_trailing_zeros && vm_mod_10 == 0
- vr_is_trailing_zeros = vr_is_trailing_zeros && (last_removed_digit == 0)
+ vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0
last_removed_digit = u8(vr_mod_10)
vr = vr_div_10
vp = vp_div_10
@@ -275,7 +275,7 @@ fn f64_to_decimal(mant u64, exp u64) Dec64 {
vp_div_10 := vp / 10
vr_div_10 := vr / 10
vr_mod_10 := vr % 10
- vr_is_trailing_zeros = vr_is_trailing_zeros && (last_removed_digit == 0)
+ vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0
last_removed_digit = u8(vr_mod_10)
vr = vr_div_10
vp = vp_div_10
@@ -283,7 +283,7 @@ fn f64_to_decimal(mant u64, exp u64) Dec64 {
removed++
}
}
- if vr_is_trailing_zeros && (last_removed_digit == 5) && (vr % 2) == 0 {
+ if vr_is_trailing_zeros && last_removed_digit == 5 && (vr % 2) == 0 {
// Round even if the exact number is .....50..0.
last_removed_digit = 4
}
@@ -343,7 +343,7 @@ pub fn f64_to_str(f f64, n_digit int) string {
// println("s:${neg} mant:${mant} exp:${exp} float:${f} byte:${u1.u:016lx}")
// Exit early for easy cases.
- if (exp == maxexp64) || (exp == 0 && mant == 0) {
+ if exp == maxexp64 || (exp == 0 && mant == 0) {
return get_string_special(neg, exp == 0, mant == 0)
}
@@ -368,7 +368,7 @@ pub fn f64_to_str_pad(f f64, n_digit int) string {
// println("s:${neg} mant:${mant} exp:${exp} float:${f} byte:${u1.u:016lx}")
// Exit early for easy cases.
- if (exp == maxexp64) || (exp == 0 && mant == 0) {
+ if exp == maxexp64 || (exp == 0 && mant == 0) {
return get_string_special(neg, exp == 0, mant == 0)
}
diff --git a/vlib/strconv/f64_str.js.v b/vlib/strconv/f64_str.js.v
index b018cf25588638..199f3de139073a 100644
--- a/vlib/strconv/f64_str.js.v
+++ b/vlib/strconv/f64_str.js.v
@@ -243,7 +243,7 @@ fn f64_to_decimal(mant u64, exp u64) Dec64 {
vr_div_10 := vr / 10
vr_mod_10 := vr % 10
vm_is_trailing_zeros = vm_is_trailing_zeros && vm_mod_10 == 0
- vr_is_trailing_zeros = vr_is_trailing_zeros && (last_removed_digit == 0)
+ vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0
last_removed_digit = u8(vr_mod_10)
vr = vr_div_10
vp = vp_div_10
@@ -260,7 +260,7 @@ fn f64_to_decimal(mant u64, exp u64) Dec64 {
vp_div_10 := vp / 10
vr_div_10 := vr / 10
vr_mod_10 := vr % 10
- vr_is_trailing_zeros = vr_is_trailing_zeros && (last_removed_digit == 0)
+ vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0
last_removed_digit = u8(vr_mod_10)
vr = vr_div_10
vp = vp_div_10
@@ -268,7 +268,7 @@ fn f64_to_decimal(mant u64, exp u64) Dec64 {
removed++
}
}
- if vr_is_trailing_zeros && (last_removed_digit == 5) && (vr % 2) == 0 {
+ if vr_is_trailing_zeros && last_removed_digit == 5 && (vr % 2) == 0 {
// Round even if the exact number is .....50..0.
last_removed_digit = 4
}
@@ -325,7 +325,7 @@ pub fn f64_to_str(f f64, n_digit int) string {
// println("s:${neg} mant:${mant} exp:${exp} float:${f} byte:${u1.u:016lx}")
// Exit early for easy cases.
- if (exp == maxexp64) || (exp == 0 && mant == 0) {
+ if exp == maxexp64 || (exp == 0 && mant == 0) {
return get_string_special(neg, exp == 0, mant == 0)
}
diff --git a/vlib/time/time.v b/vlib/time/time.v
index 329dd59f30e486..071c3fbaf54816 100644
--- a/vlib/time/time.v
+++ b/vlib/time/time.v
@@ -281,7 +281,7 @@ pub fn (t Time) long_weekday_str() string {
// is_leap_year checks if a given a year is a leap year.
pub fn is_leap_year(year int) bool {
- return (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0)
+ return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
}
// days_in_month returns a number of days in a given month.
diff --git a/vlib/v/ast/cflags.v b/vlib/v/ast/cflags.v
index 0ef6907b9e98bd..b8975abad73920 100644
--- a/vlib/v/ast/cflags.v
+++ b/vlib/v/ast/cflags.v
@@ -70,7 +70,7 @@ pub fn (mut t Table) parse_cflag(cflg string, mod string, ctimedefines []string)
if index == -1 {
value = flag.trim_space()
}
- if (name in ['-I', '-l', '-L']) && value == '' {
+ if name in ['-I', '-l', '-L'] && value == '' {
hint := if name == '-l' { 'library name' } else { 'path' }
return error('bad #flag `${flag_orig}`: missing ${hint} after `${name}`')
}
diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v
index 1b3188838672b0..a71aefff5f3049 100644
--- a/vlib/v/checker/check_types.v
+++ b/vlib/v/checker/check_types.v
@@ -272,7 +272,7 @@ fn (mut c Checker) check_expected_call_arg(got ast.Type, expected_ ast.Type, lan
if got_typ_sym.symbol_name_except_generic() == expected_typ_sym.symbol_name_except_generic() {
// Check if we are making a comparison between two different types of
// the same type like `Type[int] and &Type[]`
- if (got.is_ptr() != expected.is_ptr())
+ if got.is_ptr() != expected.is_ptr()
|| !c.check_same_module(got, expected)
|| (!got.is_ptr() && !expected.is_ptr()
&& got_typ_sym.name != expected_typ_sym.name) {
diff --git a/vlib/v/checker/orm.v b/vlib/v/checker/orm.v
index 21b0060e094400..301b6fe456cdff 100644
--- a/vlib/v/checker/orm.v
+++ b/vlib/v/checker/orm.v
@@ -203,7 +203,7 @@ fn (mut c Checker) sql_stmt_line(mut node ast.SqlStmtLine) ast.Type {
info := table_sym.info as ast.Struct
fields := c.fetch_and_verify_orm_fields(info, node.table_expr.pos, table_sym.name)
mut sub_structs := map[int]ast.SqlStmtLine{}
- for f in fields.filter(((c.table.type_symbols[int(it.typ)].kind == .struct_)
+ for f in fields.filter((c.table.type_symbols[int(it.typ)].kind == .struct_
|| (c.table.sym(it.typ).kind == .array
&& c.table.sym(c.table.sym(it.typ).array_info().elem_type).kind == .struct_))
&& c.table.get_type_name(it.typ) != 'time.Time') {
diff --git a/vlib/v/doc/doc.v b/vlib/v/doc/doc.v
index 33b691cd2b3207..14be87b3dd851b 100644
--- a/vlib/v/doc/doc.v
+++ b/vlib/v/doc/doc.v
@@ -375,7 +375,7 @@ pub fn (mut d Doc) file_ast(file_ast ast.File) map[string]DocNode {
kind: parent_node_kind
}
}
- if d.with_comments && (preceeding_comments.len > 0) {
+ if d.with_comments && preceeding_comments.len > 0 {
node.comments << preceeding_comments
}
preceeding_comments = []
diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v
index 75975140ee503e..858f1997a011a9 100644
--- a/vlib/v/fmt/fmt.v
+++ b/vlib/v/fmt/fmt.v
@@ -2147,7 +2147,18 @@ pub fn (mut f Fmt) infix_expr(node ast.InfixExpr) {
}
start_pos := f.out.len
start_len := f.line_len
- f.expr(node.left)
+ mut redundant_par := false
+ if node.left is ast.ParExpr && node.op in [.and, .logical_or] {
+ if node.left.expr is ast.InfixExpr {
+ if node.left.expr.op !in [.and, .logical_or] {
+ redundant_par = true
+ f.expr(node.left.expr)
+ }
+ }
+ }
+ if !redundant_par {
+ f.expr(node.left)
+ }
if node.before_op_comments.len > 0 {
f.comments(node.before_op_comments, iembed: node.before_op_comments[0].is_inline)
}
@@ -2173,7 +2184,18 @@ pub fn (mut f Fmt) infix_expr(node ast.InfixExpr) {
} else if is_and {
f.write(f.node_str(node.right).trim_string_left('&'))
} else {
- f.expr(node.right)
+ redundant_par = false
+ if node.right is ast.ParExpr && node.op in [.and, .logical_or] {
+ if node.right.expr is ast.InfixExpr {
+ if node.right.expr.op !in [.and, .logical_or] {
+ redundant_par = true
+ f.expr(node.right.expr)
+ }
+ }
+ }
+ if !redundant_par {
+ f.expr(node.right)
+ }
}
if !buffering_save && f.buffering {
f.buffering = false
diff --git a/vlib/v/fmt/tests/expressions_expected.vv b/vlib/v/fmt/tests/expressions_expected.vv
index ad8cffd2398a82..dacfbbcdab9bc4 100644
--- a/vlib/v/fmt/tests/expressions_expected.vv
+++ b/vlib/v/fmt/tests/expressions_expected.vv
@@ -52,7 +52,7 @@ fn main() {
println(s)
println('this is quite a long string' +
' that is followd by an even longer part that should go to another line')
- if (a == b && b > r) || (d > r) || (a < b) || (b < d && a + b > r)
+ if (a == b && b > r) || d > r || a < b || (b < d && a + b > r)
|| (a + b + d >= 0 && r < 0) || (a > b && d - r < b) {
println('ok')
}
diff --git a/vlib/v/fmt/tests/infix_expr_expected.vv b/vlib/v/fmt/tests/infix_expr_expected.vv
index 077864e97fd019..43d8461a00853b 100644
--- a/vlib/v/fmt/tests/infix_expr_expected.vv
+++ b/vlib/v/fmt/tests/infix_expr_expected.vv
@@ -22,11 +22,13 @@ fn main() {
{
{
{
- // Indent this much to force a break after the assign (`:=`).
- // Check that the trailing space is removed
- should_cast :=
- (g.table.type_kind(stmt.left_types.first()) in js.shallow_equatables)
- && (g.cast_stack.len <= 0 || stmt.left_types.first() != g.cast_stack.last())
+ {
+ // Indent this much to force a break after the assign (`:=`).
+ // Check that the trailing space is removed
+ should_cast :=
+ g.table.type_kind(stmt.left_types.first()) in js.shallow_equatables
+ && (g.cast_stack.len <= 0 || stmt.left_types.first() != g.cast_stack.last())
+ }
}
}
}
diff --git a/vlib/v/fmt/tests/infix_expr_input.vv b/vlib/v/fmt/tests/infix_expr_input.vv
index 8696809be6a4a5..7f77312d27fe6f 100644
--- a/vlib/v/fmt/tests/infix_expr_input.vv
+++ b/vlib/v/fmt/tests/infix_expr_input.vv
@@ -15,9 +15,11 @@ fn main() {
{
{
{
- // Indent this much to force a break after the assign (`:=`).
- // Check that the trailing space is removed
- should_cast := (g.table.type_kind(stmt.left_types.first()) in js.shallow_equatables) && (g.cast_stack.len <= 0 || stmt.left_types.first() != g.cast_stack.last())
+ {
+ // Indent this much to force a break after the assign (`:=`).
+ // Check that the trailing space is removed
+ should_cast := (g.table.type_kind(stmt.left_types.first()) in js.shallow_equatables) && (g.cast_stack.len <= 0 || stmt.left_types.first() != g.cast_stack.last())
+ }
}
}
}
diff --git a/vlib/v/gen/c/assign.v b/vlib/v/gen/c/assign.v
index 5d9cc916a25dd4..1631b82858d6f7 100644
--- a/vlib/v/gen/c/assign.v
+++ b/vlib/v/gen/c/assign.v
@@ -86,7 +86,8 @@ fn (mut g Gen) expr_with_opt(expr ast.Expr, expr_typ ast.Type, ret_typ ast.Type)
defer {
g.inside_opt_or_res = old_inside_opt_or_res
}
- if expr_typ.has_flag(.option) && ret_typ.has_flag(.option)&& (expr in [ast.DumpExpr, ast.Ident, ast.ComptimeSelector, ast.AsCast, ast.CallExpr, ast.MatchExpr, ast.IfExpr, ast.IndexExpr, ast.UnsafeExpr, ast.CastExpr]) {
+ if expr_typ.has_flag(.option) && ret_typ.has_flag(.option)
+ && expr in [ast.DumpExpr, ast.Ident, ast.ComptimeSelector, ast.AsCast, ast.CallExpr, ast.MatchExpr, ast.IfExpr, ast.IndexExpr, ast.UnsafeExpr, ast.CastExpr] {
if expr in [ast.Ident, ast.CastExpr] {
if expr_typ.idx() != ret_typ.idx() {
return g.expr_opt_with_cast(expr, expr_typ, ret_typ)
diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v
index fb7ec792b9f184..0c7c96489b123c 100644
--- a/vlib/v/gen/c/comptime.v
+++ b/vlib/v/gen/c/comptime.v
@@ -185,7 +185,7 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) {
continue
}
}
- if (i - 1 <= node.args.len - 1) && has_decompose
+ if i - 1 <= node.args.len - 1 && has_decompose
&& node.args[i - 1].expr is ast.ArrayDecompose {
mut d_count := 0
for d_i in i .. m.params.len {
diff --git a/vlib/v/gen/js/js.v b/vlib/v/gen/js/js.v
index 2c9f9c271fba78..2b572644351f34 100644
--- a/vlib/v/gen/js/js.v
+++ b/vlib/v/gen/js/js.v
@@ -1465,7 +1465,7 @@ fn (mut g JsGen) gen_assign_stmt(stmt ast.AssignStmt, semicolon bool) {
should_cast := if stmt.left_types.len == 0 {
false
} else {
- (g.table.type_kind(stmt.left_types.first()) in js.shallow_equatables)
+ g.table.type_kind(stmt.left_types.first()) in js.shallow_equatables
&& (g.cast_stack.len <= 0 || stmt.left_types.first() != g.cast_stack.last())
}
diff --git a/vlib/v/markused/walker.v b/vlib/v/markused/walker.v
index 127344c561fd7b..22363bccb2b3b4 100644
--- a/vlib/v/markused/walker.v
+++ b/vlib/v/markused/walker.v
@@ -514,7 +514,7 @@ pub fn (mut w Walker) call_expr(mut node ast.CallExpr) {
w.mark_fn_as_used(fn_name)
stmt := w.all_fns[fn_name] or { return }
if stmt.name == node.name {
- if !node.is_method || (node.receiver_type == stmt.receiver.typ) {
+ if !node.is_method || node.receiver_type == stmt.receiver.typ {
w.stmts(stmt.stmts)
}
}
diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v
index 03305ea6fbd1ce..e2912a146334fc 100644
--- a/vlib/v/parser/parser.v
+++ b/vlib/v/parser/parser.v
@@ -3018,7 +3018,7 @@ fn (mut p Parser) dot_expr(left ast.Expr) ast.Expr {
name_pos := p.tok.pos()
mut field_name := ''
// check if the name is on the same line as the dot
- if (p.prev_tok.pos().line_nr == name_pos.line_nr) || p.tok.kind != .name {
+ if p.prev_tok.pos().line_nr == name_pos.line_nr || p.tok.kind != .name {
field_name = p.check_name()
} else {
p.name_error = true
diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v
index 03e754c59e3f90..56b607c40c2515 100644
--- a/vlib/v/scanner/scanner.v
+++ b/vlib/v/scanner/scanner.v
@@ -158,7 +158,7 @@ pub fn (mut s Scanner) free() {
[inline]
fn (s &Scanner) should_parse_comment() bool {
- return (s.comments_mode == .parse_comments)
+ return s.comments_mode == .parse_comments
|| (s.comments_mode == .toplevel_comments && !s.is_inside_toplvl_statement)
}
@@ -520,7 +520,7 @@ fn (mut s Scanner) skip_whitespace() {
s.pos++
continue
}
- if !(c == 32 || (c > 8 && c < 14) || (c == 0x85) || (c == 0xa0)) {
+ if !(c == 32 || (c > 8 && c < 14) || c == 0x85 || c == 0xa0) {
return
}
c_is_nl := c == scanner.b_cr || c == scanner.b_lf
@@ -1432,7 +1432,7 @@ fn (mut s Scanner) ident_char() string {
// e.g. (octal) \141 (hex) \x61 or (unicode) \u2605
// we don't handle binary escape codes in rune literals
orig := c
- if (c.len % 2 == 0) && (escaped_hex || escaped_unicode || escaped_octal) {
+ if c.len % 2 == 0 && (escaped_hex || escaped_unicode || escaped_octal) {
if escaped_unicode {
// there can only be one, so attempt to decode it now
c = s.decode_u_escapes(c, 0, [0])
diff --git a/vlib/v/tests/bench/math_big_gcd/prime/maker.v b/vlib/v/tests/bench/math_big_gcd/prime/maker.v
index ce2f8dcea3cd62..a43e872ff7c876 100644
--- a/vlib/v/tests/bench/math_big_gcd/prime/maker.v
+++ b/vlib/v/tests/bench/math_big_gcd/prime/maker.v
@@ -51,7 +51,7 @@ pub fn (p PrimeSet) str() string {
fn extract_count(s string) int {
digits := '0123456789'.split('')
- if (s == '') || !s.split('').any(it in digits) {
+ if s == '' || !s.split('').any(it in digits) {
return 0
}
ds := s.split('').filter(it in digits)
diff --git a/vlib/v/tests/if_expr_with_array_call_test.v b/vlib/v/tests/if_expr_with_array_call_test.v
index f301c6b049106b..3bf89e1b844288 100644
--- a/vlib/v/tests/if_expr_with_array_call_test.v
+++ b/vlib/v/tests/if_expr_with_array_call_test.v
@@ -56,7 +56,7 @@ fn test_if_expr_with_array_call_filter() {
assert true
}
- if arr.len == 1 || (arr[1].bytes().filter(it.is_letter()).len == 0) {
+ if arr.len == 1 || arr[1].bytes().filter(it.is_letter()).len == 0 {
println('yes')
assert true
}
diff --git a/vlib/v/tests/interface_test.v b/vlib/v/tests/interface_test.v
index f0db9159163f94..33e1f968a883bd 100644
--- a/vlib/v/tests/interface_test.v
+++ b/vlib/v/tests/interface_test.v
@@ -89,7 +89,7 @@ fn is_dog_or_cat(a Animal) bool {
println('Animal is Dog or Cat: is a Dog: ${is_dog}, is a Cat: ${is_cat}')
// return is_dog || is_cat
// shorter syntax
- is_dog_or_cat := if (a is Dog) || (a is Cat) { true } else { false }
+ is_dog_or_cat := if a is Dog || a is Cat { true } else { false }
println('Animal is Dog or Cat: ${is_dog_or_cat}')
return is_dog_or_cat
}
@@ -359,7 +359,7 @@ fn is_dog(a Animal) bool {
println('with type: ${typeof(a).name}') // get implementation type (if possible)
// sample (additional checks) here
- is_dog_or_cat := if (a is Dog) || (a is Cat) { true } else { false }
+ is_dog_or_cat := if a is Dog || a is Cat { true } else { false }
println('Animal is Dog or Cat: ${is_dog_or_cat}')
// use/test even another syntax
diff --git a/vlib/v/util/quote.v b/vlib/v/util/quote.v
index 4712734427e99d..76912dd87f42ca 100644
--- a/vlib/v/util/quote.v
+++ b/vlib/v/util/quote.v
@@ -24,8 +24,7 @@ pub fn smart_quote(str string, raw bool) string {
mut is_pure := true
for i := 0; i < len; i++ {
ch := u8(str[i])
- if (ch >= 37 && ch <= 90) || (ch >= 95 && ch <= 126)
- || (ch in [` `, `!`, `#`, `[`, `]`]) {
+ if (ch >= 37 && ch <= 90) || (ch >= 95 && ch <= 126) || ch in [` `, `!`, `#`, `[`, `]`] {
// safe punctuation + digits + big latin letters,
// small latin letters + more safe punctuation,
// important punctuation exceptions, that are not