Hacker News new | ask | show | jobs
by staticassertion 3400 days ago
That would this in rust: if number { true } else { false }

If it's the last expression it will implicitly return the values. Easily fits on one line.

1 comments

My one puny objection to this is that rustfmt won't put the arms on a single line, but will always break and indent around the blocks. That makes Rust's expression-if considerably more verbose than what Perl has, or even the ternary operator.
Hm. I wonder if this is configurable, or if there's an RFC open for this.