A switch statement has fewer than three sections and reads more simply as an if

tx0/csharp:small-switchallwarningstyle/conventionsdepth faststyle

What it finds

A switch with one or two sections is an if or an if/else written at more length. Switches with patterns or when clauses are left alone.

From the rule's source, small_switch.rs.

Example from the rule's tests
class Toggle{    void Set(int mode)    {        switch (mode)tx0 reports: this switch has only 2 section(s)        {            case 0:                Off();                break;            default:                On();                break;        }    }     void Off() { }     void On() { }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the all tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:small-switch" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:small-switch] reason="..."

tx0 explain tx0/csharp:small-switch shows the same in the terminal. Found a false positive? Report it.