What is the actual reason of having `->` before return type

It's come up in passing many times. i don't know if there's ever been a dedicated discussion about it.

Personally I've never really been a fan. Even in C# -- where the language isn't expression-oriented by default, so using => saves a return -- I'm not a big fan of it in functions, because it's just another thing to argue about in formatting discussions. (I do like it in C# for get-only properties, though.) So in Rust when the difference between { 4 } and = 4; is just a space, I'm not convinced that it pulls its weight.

1 Like