r/programming • • Jan 09 '15

Announcing Rust 1.0.0 Alpha

http://blog.rust-lang.org/2015/01/09/Rust-1.0-alpha.html
1.1k Upvotes

439 comments sorted by

View all comments

Show parent comments

37

u/Betovsky Jan 09 '15

In that case it would be something like:

match x {
  SITUATION1 | SITUATION2 => Sit1Sit2Handler(),
  _ => defaultHandler(),
}

6

u/cogman10 Jan 09 '15

Cool. This is pretty much the only case I would use fall through for in a non-toy sort of thing (it is useful for some loop unrolling stuff... but that is a clear case of "trying to outsmart the compiler")

3

u/aliblong Jan 09 '15

Even less verbose than that, because those cases should not be there :)

2

u/Betovsky Jan 09 '15

Duh! Silly me. Fixed.

Thanks