Skip to content

Commit

Permalink
minor: else-less code style
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Jul 16, 2024
1 parent 06cd879 commit 7d1ea7b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions decor/eta.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ func (d *movingAverageETA) Decor(s Statistics) (string, int) {
func (d *movingAverageETA) EwmaUpdate(n int64, dur time.Duration) {
if n <= 0 {
d.zDur += dur
} else {
durPerItem := float64(d.zDur+dur) / float64(n)
if math.IsInf(durPerItem, 0) || math.IsNaN(durPerItem) {
d.zDur += dur
return
}
d.zDur = 0
d.average.Add(durPerItem)
return
}
durPerItem := float64(d.zDur+dur) / float64(n)
if math.IsInf(durPerItem, 0) || math.IsNaN(durPerItem) {
d.zDur += dur
return
}
d.zDur = 0
d.average.Add(durPerItem)
}

// AverageETA decorator. It's wrapper of NewAverageETA.
Expand Down
16 changes: 8 additions & 8 deletions decor/speed.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ func (d *movingAverageSpeed) Decor(_ Statistics) (string, int) {
func (d *movingAverageSpeed) EwmaUpdate(n int64, dur time.Duration) {
if n <= 0 {
d.zDur += dur
} else {
durPerByte := float64(d.zDur+dur) / float64(n)
if math.IsInf(durPerByte, 0) || math.IsNaN(durPerByte) {
d.zDur += dur
return
}
d.zDur = 0
d.average.Add(durPerByte)
return
}
durPerByte := float64(d.zDur+dur) / float64(n)
if math.IsInf(durPerByte, 0) || math.IsNaN(durPerByte) {
d.zDur += dur
return
}
d.zDur = 0
d.average.Add(durPerByte)
}

// AverageSpeed decorator with dynamic unit measure adjustment. It's
Expand Down

0 comments on commit 7d1ea7b

Please sign in to comment.