3 ms·
Yeah, that's one thing that's really putting me off looking at Rust - the possibility of it enforcing style in the future. Hanging braces style for C/C++ is ra
by berkut 11y ago
Yeah, that's one thing that's really putting me off looking at Rust - the possibility of it enforcing style in the future.
Hanging braces style for C/C++ is rarely allowed in the coding standards I've had to use in the past for embedded and real-time stuff in the defence industry, because it can be a source of errors.
Aligned opening and closing braces are much more common (in line with ADA's style).
- nrc 11y agoThe compiler will not enforce more style in the future, that will be done by Rustfmt, a separate and optional tool. In fact, it is likely that the compiler lints which enforce style will move out of the compiler and in to Rustfmt at some point in the future.
- Manishearth 11y agoRust doesn't enforce style anywhere. You can turn off all style warnings at once too with `#![allow(bad_style)]` or a command line flag. By default it just warns. That's not enforcing.
- andresmanz 11y agoCome on, even that flag's name is ridiculous. They basically say, for example, that writing camel case, which is the preferred style in most of the projects I've seen, is bad style. Do they like being unnecessarily antipathetic? People think about their personal preferred style for years, and they have very good reasons for choosing them. And in _many_ cases, it's exactly the style that's called bad by Rust's creators. How about making it the opposite, '#![allow(default_style)]'? Or at least '#![allow(non_default_style)]'?
- Manishearth 11y agoIn some cases skirting style can be harmful (e.g. in match statements there's an ambiguity with enum variants and variable bindings that is not an issue because of the style lints). But I get your point. I think people would be open to that naming change if you file an issue.
- andresmanz 11y agoYes, you're right, of course. Maybe I could at least try, yes. I mean... It's kind of silly, I know, but that would already change the way I look at Rust.