Condense switch fallthroughs into expr lists

This commit is contained in:
Sam Boyer 2015-05-26 21:30:14 -04:00
parent 6f76f3302f
commit bdc5983463
4 changed files with 5 additions and 19 deletions

View File

@ -638,13 +638,7 @@ func (c *Command) Run(args []string) int {
c.Ui.Output(update.Op)
c.Ui.Info(fmt.Sprintf("%.2f%%", update.Progress))
case update.Progress-lastProgress >= 5:
fallthrough
case time.Now().Sub(lastFlush) > time.Second:
fallthrough
case update.Progress == 100:
case update.Progress-lastProgress >= 5, time.Now().Sub(lastFlush) > time.Second, update.Progress == 100:
lastFlush = time.Now()
lastProgress = update.Progress
c.Ui.Info(fmt.Sprintf("%.2f%%", update.Progress))

View File

@ -224,9 +224,7 @@ func (c *Client) lanEventHandler() {
switch e.EventType() {
case serf.EventMemberJoin:
c.nodeJoin(e.(serf.MemberEvent))
case serf.EventMemberLeave:
fallthrough
case serf.EventMemberFailed:
case serf.EventMemberLeave, serf.EventMemberFailed:
c.nodeFail(e.(serf.MemberEvent))
case serf.EventUser:
c.localEvent(e.(serf.UserEvent))

View File

@ -230,9 +230,7 @@ func (c *consulFSM) applyACLOperation(buf []byte, index uint64) interface{} {
}
defer metrics.MeasureSince([]string{"consul", "fsm", "acl", string(req.Op)}, time.Now())
switch req.Op {
case structs.ACLForceSet:
fallthrough
case structs.ACLSet:
case structs.ACLForceSet, structs.ACLSet:
if err := c.state.ACLSet(index, &req.ACL); err != nil {
return err
} else {

View File

@ -41,9 +41,7 @@ func (s *Server) lanEventHandler() {
s.nodeJoin(e.(serf.MemberEvent), false)
s.localMemberEvent(e.(serf.MemberEvent))
case serf.EventMemberLeave:
fallthrough
case serf.EventMemberFailed:
case serf.EventMemberLeave, serf.EventMemberFailed:
s.nodeFailed(e.(serf.MemberEvent), false)
s.localMemberEvent(e.(serf.MemberEvent))
@ -71,9 +69,7 @@ func (s *Server) wanEventHandler() {
switch e.EventType() {
case serf.EventMemberJoin:
s.nodeJoin(e.(serf.MemberEvent), true)
case serf.EventMemberLeave:
fallthrough
case serf.EventMemberFailed:
case serf.EventMemberLeave, serf.EventMemberFailed:
s.nodeFailed(e.(serf.MemberEvent), true)
case serf.EventMemberUpdate: // Ignore
case serf.EventMemberReap: // Ignore