Closed gingerBill closed 1 year ago
Ideas for the -simplify
flag:
Compound literals of the form:
[]T{T{}, T{}}
can be simplified to:
[]T{{}, {}}
Ranged for loops for the form:
for x, _ in v {...}
can be simplified to:
for x in v {...}
Ranged for loops for the form:
for _ in v {...}
can be simplified to:
for in v {...}
Slice expressions of the form:
s[a:len(s)]
can be simplified to:
s[a:]
Slice expressions of the form:
s[0:n]
can be simplified to:
s[:n]
Slice expressions of the form:
s[:][:]
can be simplified to:
s[:]
Brace styles:
default and 1tbs
foo :: proc(x: int) -> int {
if x > 0 {
return x * 123;
} else {
return -x * 345;
}
}
allman
foo :: proc(x: int) -> int
{
if x > 0
{
return x * 123;
}
else
{
return -x * 345;
}
}
k&r
foo :: proc(x: int) -> int
{
if x > 0 {
return x * 123;
} else {
return -x * 345;
}
}
stroustrup
foo :: proc(x: int) -> int {
if x > 0 {
return x * 123;
}
else {
return -x * 345;
}
}
Not sure what discussion category this should be converted to @gingerBill
I'll take this on as long as you are okay with an Odin rookie doing it.
Odinfmt is already being worked on but you’re welcome to try anyway :)
Hello!
I am marking this issue as stale as it has not received any engagement from the community or maintainers 120 days. That does not imply that the issue has no merit! If you feel strongly about this issue
The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone..
Automatic code formatter for the Odin programming language.
Requirements:
core:odin/parser
Default style overview:
Usage: