1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: remove redundant parenthesis in the complex infix expr (#17873)

This commit is contained in:
yuyi
2023-04-04 18:47:48 +08:00
committed by GitHub
parent 8452644ec3
commit 467a1b4435
44 changed files with 141 additions and 117 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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++
}

View File

@@ -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++
}