Good
fn inc(a: u32) -> u32 { a + 1 }
fn foo(a: u32, b: u32) -> u32 { let x = a + b; a * x }
Bad fn bar(...) -> bool {
let mut success = false;
let conn = getConnection();
...
if x > y {
return false;
} else if z < q {
success = false;
}
foo.barify(x, y);
...
success
}
It looks especially bad when the function has multiple early returns, and then the final return looks different."Nicer" is a subjective thing. BTW in the trivial case above one may judge this or that to be nicer, but in a large method, 'return func(a,b,c)' is obvious, whereas looking at 'func(a,b,c)' it is super non-obvious that the value is being returned.
Then "foo.map(|x| :x+1)" is nice. If that doesn't stand out enough for some people on a line of its own, make your editor render the unary colon line in a very bold color for you.
Maybe you are writing code for the Rust standard library, where following the core projects style recommendations would be important for consistency.
Maybe you don't want to start from scratch coming up with your own style, and want a decent starting point from which you can vary as your team figures out what does/doesn't work for them.
Lots of reasons to have a language project also provide default style recommendations.
On the one hand, it is an objective fact that it is considered, by the authors, poor style.
On the other hand, that it is "considered" anything is an explicit (not merely implicit) statement that it is subjective (and "poor style" -- or good style, for that matter is inherently subjective in any case.) So, characterizing that language as making it sound "like their recommendations are objective facts" seems quite bizarre.