Skip to content

Commit

Permalink
code style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Brat-vseznamus committed Jul 4, 2024
1 parent 4f6bc66 commit 9057e14
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions internal/tlcodegen/tlgen_cpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (gen *Gen2) generateCodeCPP(generateByteVersions []string) error {
}

for group, groupDetails := range groupsToDetails {
for det, _ := range groupDetails {
for det := range groupDetails {
for _, spec := range detailsCpps[det] {
if spec.groupName != group {
return fmt.Errorf(`in details "%s" has different groups mentioned: "%s" and "%s"`, det, group, spec.groupName)
Expand Down Expand Up @@ -336,7 +336,6 @@ func (gen *Gen2) decideCppCodeDestinations(allTypes []*TypeRWWrapper) {
}
}

allTypesWithoutGroup := make([]*TypeRWWrapper, 0)
allTypesWithoutGroupMap := make(map[*TypeRWWrapper]bool)
allTypesWithoutGroupUsages := make(map[*TypeRWWrapper]map[string]bool)
reverseDepsEdges := make(map[*TypeRWWrapper]map[*TypeRWWrapper]bool)
Expand All @@ -345,7 +344,6 @@ func (gen *Gen2) decideCppCodeDestinations(allTypes []*TypeRWWrapper) {
if t.groupName != NoNamespaceGroup {
continue
}
allTypesWithoutGroup = append(allTypesWithoutGroup, t)
allTypesWithoutGroupMap[t] = true
}

Expand Down Expand Up @@ -380,7 +378,7 @@ func (gen *Gen2) decideCppCodeDestinations(allTypes []*TypeRWWrapper) {
visited := make(map[*TypeRWWrapper]bool)
front := make(map[*TypeRWWrapper]bool)

for t, _ := range edges {
for t := range edges {
if t.groupName != NoNamespaceGroup {
front[t] = true
} else if t.groupName == NoNamespaceGroup && len(reverseEdges[t]) == 0 {
Expand All @@ -395,7 +393,7 @@ func (gen *Gen2) decideCppCodeDestinations(allTypes []*TypeRWWrapper) {

for len(front) != 0 {
newFront := make(map[*TypeRWWrapper]bool)
for v, _ := range front {
for v := range front {
for _, to := range edges[v] {
if visited[to] {
continue
Expand Down
2 changes: 1 addition & 1 deletion internal/tlcodegen/type_rw.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func mapToPairArray[L comparable, R any](m *map[L]R) (res []Pair[L, R]) {
func (d DirectIncludesCPP) sortedIncludes(componentOrder []int, typeToFile func(wrapper *TypeRWWrapper) string) (result []string) {
includeNamesToTypes := make(map[string]int)

for tp, _ := range d.ns {
for tp := range d.ns {
include := typeToFile(tp)
if _, ok := includeNamesToTypes[include]; !ok {
includeNamesToTypes[include] = tp.typeComponent
Expand Down
6 changes: 3 additions & 3 deletions internal/utils/data_structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func CopyMap[K comparable, V any](m *map[K]V) map[K]V {

// unstable
func Keys[K comparable, V any](m *map[K]V) (res []K) {
for k, _ := range *m {
for k := range *m {
res = append(res, k)
}
return
Expand All @@ -27,7 +27,7 @@ func Keys[K comparable, V any](m *map[K]V) (res []K) {
// unstable
func SetToSlice[T comparable](s *map[T]bool) []T {
m := make([]T, 0)
for k, _ := range *s {
for k := range *s {
m = append(m, k)
}
return m
Expand Down Expand Up @@ -60,7 +60,7 @@ func ReverseSetOfPairs[K, V comparable](in map[K]map[V]bool) map[V]map[K]bool {
m := make(map[V]map[K]bool)

for k, vs := range in {
for v, _ := range vs {
for v := range vs {
PutPairToSetOfPairs(&m, v, k)
}
}
Expand Down

0 comments on commit 9057e14

Please sign in to comment.