Semicolon to end a match line with no return

This minor annoyance has come up for me several times recently, and I feel this is a reasonable solution,

match something{
   Case(n) => {
        line_which_returns_something_i_dont_want(n);
    }
    OtherCase => could_just_end_with_a_semicolon();
}

So normally a match case ends with a comma but if the function returns something you don't want to handle, (eg tree insert returns an option of the previous value) You have to create a block to allow for the semicolon to cancel the result.

But if there was a semantic difference between a comma and a semicolon, then, the block would not be needed for a single line, action.

Thoughts?

1 Like

Not returning from a match branch is pretty trivial:

match something {
   Case(n) => { returns_something_i_dont_want(n); },
}

I don't see the benefit of this.

2 Likes

And of course

match something {
   Case(n) => drop(returns_something_i_dont_want(n)),
}
3 Likes

Perhaps my problem is with rustfmt, but rustfmt insists that this should be spread over three lines.