-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow in-line switch #181
Comments
I stand behind the current rules that are idiosyncratic to switch(
Very_long_stuff_suffix,
k = 1,
m = 2,
g = 3,
t = 4,
p = 5
) For the discussion that lead to the current implementation, see #39. |
I prefer the one-line per argument form, but I agree that if everything can fit on one line, that's also an acceptable styling. |
Current advice in the guide prevents statements like the following:
I think the alternative wastes a lot of real estate:
The current examples don't address this case specifically... the
good
example has a fall-through stop, in which case keeping it on its own line is similar to theControl flow
recommendations. And once one argument gets its own line, I agree all should.But also as mentioned, lacking a fall-through stop is OK if the input has been validated (e.g. with
match.arg()
).The other non-positional
bad
examples use fall-through; I agree on using new lines in the fall-through case as well, since it's visually clearer.That leaves an example like mine: (1) input is pre-validated, so we don't need a fall-through; and (2) all arguments get values.
The text was updated successfully, but these errors were encountered: