General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
p11
ThePrimeTime
comments
Comments by "p11" (@porky1118) on "We Removed C++" video.
52:15 In Rust, I recently wrote a extension method "select" for bools. So the "ternary" expression "if c { a } else { b }" can also be written as "c.select(a, b)", so when I just choose one of two values based on some condition, the formatter will never turn this one line into 5 lines anymore.
9
53:10 But in Rust, there aren''t real ternaries. There's just if-else, and in this case, something like this is acceptalbe. But I still prefer early returns (breaks/continues) nowadays, where it's possible instead of using nested ifs. Sometimes I create new functions just to be able to return early.
3
@haemolacriaa rustfmt::skip is even more verbose. And the main reason is, that functional style seems more elegant for such simple cases.
3
RIIR (GitHub)
1
@thewhitefalcon8539 Because I want to format consistently. And using the default rules is just the easiest and it's pretty good.
1
@thewhitefalcon8539 I was talking about consistent formatting.
1