Skip to content

Commit

Permalink
Removing incorrect comment about a warning (valkey-io#1132)
Browse files Browse the repository at this point in the history
There is a lot of bad legacy usage of `default:` with enums, which is an
anti-pattern. If you omit the default, the compiler will tell you if a
new enum value was added and that it is missing from a switch statement.

Someone mentioned on another PR they used `default:` because of this
warning, so just removing it, but might create an issue to do a wider
cleanup.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
  • Loading branch information
madolson authored and eifrah-aws committed Oct 20, 2024
1 parent 219e646 commit bd2666c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,8 @@ static clusterNode *clusterNodeIterNext(ClusterNodeIterator *iter) {
/* Return the value associated with the node, or NULL if no more nodes */
return ln ? listNodeValue(ln) : NULL;
}
/* This line is unreachable but added to avoid compiler warnings */
default: {
serverPanic("bad type");
return NULL;
}
}
serverPanic("Unknown iterator type %d", iter->type);
}

static void clusterNodeIterReset(ClusterNodeIterator *iter) {
Expand Down

0 comments on commit bd2666c

Please sign in to comment.