Codebase list golang-github-vbauerster-mpb / 4b7689b
refactoring: (*bFiller).Fill prefer switch to if, which allows some dry code Vladimir Bauer 1 year, 11 months ago
1 changed file(s) with 5 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
240240 s.tip.count++
241241 fillCount += tip.width
242242 }
243 if stat.Refill != 0 {
244 refWidth := int(internal.PercentageRound(stat.Total, stat.Refill, uint(width)))
243 switch refWidth := 0; {
244 case stat.Refill != 0:
245 refWidth = int(internal.PercentageRound(stat.Total, stat.Refill, uint(width)))
245246 curWidth -= refWidth
246247 refWidth += curWidth
248 fallthrough
249 default:
247250 for w := s.components[iFiller].width; curWidth-fillCount >= w; fillCount += w {
248251 filling = append(filling, s.components[iFiller].bytes...)
249252 }
250253 for w := s.components[iRefiller].width; refWidth-fillCount >= w; fillCount += w {
251254 refilling = append(refilling, s.components[iRefiller].bytes...)
252 }
253 } else {
254 for w := s.components[iFiller].width; curWidth-fillCount >= w; fillCount += w {
255 filling = append(filling, s.components[iFiller].bytes...)
256255 }
257256 }
258257 }