Skip to content

Commit bd1a132

Browse files
yuyi98l1mey112
authored andcommitted
fmt: remove redundant parenthesis in the complex infix expr (vlang#17873)
1 parent 5f4ddc8 commit bd1a132

44 files changed

Lines changed: 141 additions & 117 deletions

Some content is hidden

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

cmd/tools/vdoc/html.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn (vd VDoc) write_content(cn &doc.DocNode, d &doc.Doc, mut hw strings.Builder)
169169
os.file_name(cn.file_path)
170170
}
171171
src_link := get_src_link(vd.manifest.repo_url, file_path_name, cn.pos.line_nr + 1)
172-
if cn.content.len != 0 || (cn.name == 'Constants') {
172+
if cn.content.len != 0 || cn.name == 'Constants' {
173173
hw.write_string(doc_node_html(cn, src_link, false, cfg.include_examples, d.table))
174174
}
175175
for child in cn.children {

cmd/tools/vtest-parser.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ fn (mut context Context) print_status() {
260260
if context.is_silent {
261261
return
262262
}
263-
if (context.cut_index == 1) && (context.max_index == 0) {
263+
if context.cut_index == 1 && context.max_index == 0 {
264264
return
265265
}
266266
msg := '> ${context.path:-30} | index: ${context.cut_index:5}/${context.max_index - 1:5}'

examples/game_of_life/life.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn (mut g Game) evolve() {
3737
temp_grid << []string{}
3838
for y in 0 .. g.grid[x].len {
3939
count := g.get_surrounding_alive_count(x, y)
40-
if count == 3 || ((g.grid[x][y] == cell) && count == 2) {
40+
if count == 3 || (g.grid[x][y] == cell && count == 2) {
4141
temp_grid[x] << cell
4242
} else {
4343
temp_grid[x] << nothing

examples/graphs/bellman-ford.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn bellman_ford[T](graph [][]T, src int) {
7474
mut u := edges[j].src
7575
mut v := edges[j].dest
7676
mut weight := edges[j].weight
77-
if (dist[u] != large) && (dist[u] + weight < dist[v]) {
77+
if dist[u] != large && dist[u] + weight < dist[v] {
7878
dist[v] = dist[u] + weight
7979
}
8080
}
@@ -88,7 +88,7 @@ fn bellman_ford[T](graph [][]T, src int) {
8888
mut u := edges[j].src
8989
mut v := edges[j].dest
9090
mut weight := edges[j].weight
91-
if (dist[u] != large) && (dist[u] + weight < dist[v]) {
91+
if dist[u] != large && dist[u] + weight < dist[v] {
9292
print('\n Graph contains negative weight cycle')
9393
// If negative cycle is detected, simply
9494
// return or an exit(1)

examples/graphs/bfs2.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn build_path_reverse(graph map[string][]string, start string, final string, vis
7777

7878
for (current != start) {
7979
for i in array_of_nodes {
80-
if (current in graph[i]) && (visited[i] == true) {
80+
if current in graph[i] && visited[i] == true {
8181
current = i
8282
break // the first ocurrence is enough
8383
}

examples/graphs/dfs.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn build_path_reverse(graph map[string][]string, start string, final string, vis
9191

9292
for current != start {
9393
for i in array_of_nodes {
94-
if (current in graph[i]) && (visited[i] == true) {
94+
if current in graph[i] && visited[i] == true {
9595
current = i
9696
break // the first ocurrence is enough
9797
}

examples/graphs/dijkstra.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn push_pq[T](mut prior_queue []T, data int, priority int) {
4141
lenght_pq := prior_queue.len
4242

4343
mut i := 0
44-
for (i < lenght_pq) && (priority > prior_queue[i].priority) {
44+
for i < lenght_pq && priority > prior_queue[i].priority {
4545
temp << prior_queue[i]
4646
i++
4747
}

examples/graphs/minimal_spann_tree_prim.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn push_pq[T](mut prior_queue []T, data int, priority int) {
3535
lenght_pq := prior_queue.len
3636

3737
mut i := 0
38-
for (i < lenght_pq) && (priority > prior_queue[i].priority) {
38+
for i < lenght_pq && priority > prior_queue[i].priority {
3939
temp << prior_queue[i]
4040
i++
4141
}

vlib/builtin/js/string_test.js.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ fn test_split_into_lines() {
831831

832832
assert lines_mixed_trailers.len == 9
833833
for line in lines_mixed_trailers {
834-
assert (line == line_content) || (line == '')
834+
assert line == line_content || line == ''
835835
}
836836
}
837837

vlib/builtin/string.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ pub fn (s string) split_into_lines() []string {
10191019
line_start = i + 1
10201020
} else if s[i] == cr {
10211021
res << if line_start == i { '' } else { s[line_start..i] }
1022-
if ((i + 1) < s.len) && (s[i + 1] == lf) {
1022+
if (i + 1) < s.len && s[i + 1] == lf {
10231023
line_start = i + 2
10241024
} else {
10251025
line_start = i + 1
@@ -1796,7 +1796,7 @@ fn (s string) at_with_check(idx int) ?u8 {
17961796
pub fn (c u8) is_space() bool {
17971797
// 0x85 is NEXT LINE (NEL)
17981798
// 0xa0 is NO-BREAK SPACE
1799-
return c == 32 || (c > 8 && c < 14) || (c == 0x85) || (c == 0xa0)
1799+
return c == 32 || (c > 8 && c < 14) || c == 0x85 || c == 0xa0
18001800
}
18011801

18021802
// is_digit returns `true` if the byte is in range 0-9 and `false` otherwise.

0 commit comments

Comments
 (0)