fmt: fix alignment of struct init fields (#22025)

This commit is contained in:
yuyi 2024-08-11 14:11:24 +08:00 committed by GitHub
parent 99da5726db
commit c51d30bf53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
671 changed files with 18817 additions and 18787 deletions

View file

@ -33,21 +33,21 @@ fn test_now_always_results_in_greater_time() {
fn test_time1_should_be_same_as_time2() {
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
t2 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
assert t1 == t2
@ -55,41 +55,41 @@ fn test_time1_should_be_same_as_time2() {
fn test_time1_should_not_be_same_as_time2() {
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
// Difference is one nanosecond
t2 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 101
})
t3 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 0
})
// Difference is one second
t4 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 4
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 4
nanosecond: 0
})
assert t1 != t2
@ -98,41 +98,41 @@ fn test_time1_should_not_be_same_as_time2() {
fn test_time1_should_be_greater_than_time2() {
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 102
})
// Difference is one nanosecond
t2 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 101
})
t3 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 5
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 5
nanosecond: 0
})
// Difference is one second
t4 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 4
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 4
nanosecond: 0
})
assert t1 > t2
@ -141,41 +141,41 @@ fn test_time1_should_be_greater_than_time2() {
fn test_time2_should_be_less_than_time1() {
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 102
})
// Difference is one nanosecond
t2 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 101
})
t3 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 0
})
// Difference is one second
t4 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 2
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 2
nanosecond: 0
})
assert t2 < t1
@ -184,41 +184,41 @@ fn test_time2_should_be_less_than_time1() {
fn test_time1_should_be_greater_or_equal_to_time2_when_gt() {
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 102
})
// Difference is one nanosecond
t2 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 101
})
t3 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 5
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 5
nanosecond: 0
})
// Difference is one second
t4 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 4
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 4
nanosecond: 0
})
assert t1 >= t2
@ -227,41 +227,41 @@ fn test_time1_should_be_greater_or_equal_to_time2_when_gt() {
fn test_time1_should_be_greater_or_equal_to_time2_when_eq() {
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
// Difference is one nanosecond
t2 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
t3 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 0
})
// Difference is one second
t4 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 0
})
assert t1 >= t2
@ -270,41 +270,41 @@ fn test_time1_should_be_greater_or_equal_to_time2_when_eq() {
fn test_time1_should_be_less_or_equal_to_time2_when_lt() {
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
// Difference is one nanosecond
t2 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 101
})
t3 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 0
})
// Difference is one second
t4 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 4
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 4
nanosecond: 0
})
assert t1 <= t2
@ -313,41 +313,41 @@ fn test_time1_should_be_less_or_equal_to_time2_when_lt() {
fn test_time1_should_be_less_or_equal_to_time2_when_eq() {
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
// Difference is one nanosecond
t2 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
t3 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 0
})
// Difference is one second
t4 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 0
})
assert t1 <= t2
@ -356,12 +356,12 @@ fn test_time1_should_be_less_or_equal_to_time2_when_eq() {
fn test_time2_copied_from_time1_should_be_equal() {
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
t2 := new(t1)
@ -373,12 +373,12 @@ fn test_subtract() {
d_nanoseconds := 13
duration := d_seconds * second + d_nanoseconds * nanosecond
t1 := new(Time{
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
year: 2000
month: 5
day: 10
hour: 22
minute: 11
second: 3
nanosecond: 100
})
t2 := unix_nanosecond(i64(t1.unix) + d_seconds, t1.nanosecond + d_nanoseconds)