I like to consider my Rust to be pretty stylish, but there are definitely recommendations here I could implement. For instance, I tend towards complicated iterator chains when a for loop is easier to read, and I'm guilty of putting iterator combinators in loop headers. I think I'm a point-free Haskeller at heart :)
I disagree with Google about crate size, though. Maybe it's more ergonomic with Google's internal build tooling, but with Cargo I would definitely rather crates contain more than a few .rs files if the complexity is warranted. To be fair, this section seems to only apply to Chrome, and I know nothing about their build system.
This may be out of date, but I thought that incremental builds worked a lot better when there were a lot of crate boundaries. As in if there are a lot of small crates, then those don't have to be recompiled, but if it is only one large crate, then everything will have to be recompiled.
I'm not sure if this applies to GN specifically, but I know a lot of external build systems for Rust don't support persisting the incremental build caches from a single crate to be reused next time it's built, so your only unit of incrementalism is at the crate level.
novedevo | 5 hours ago
I like to consider my Rust to be pretty stylish, but there are definitely recommendations here I could implement. For instance, I tend towards complicated iterator chains when a for loop is easier to read, and I'm guilty of putting iterator combinators in loop headers. I think I'm a point-free Haskeller at heart :)
I disagree with Google about crate size, though. Maybe it's more ergonomic with Google's internal build tooling, but with Cargo I would definitely rather crates contain more than a few
.rsfiles if the complexity is warranted. To be fair, this section seems to only apply to Chrome, and I know nothing about their build system.siru | 5 hours ago
This may be out of date, but I thought that incremental builds worked a lot better when there were a lot of crate boundaries. As in if there are a lot of small crates, then those don't have to be recompiled, but if it is only one large crate, then everything will have to be recompiled.
refi64 | 2 hours ago
I'm not sure if this applies to GN specifically, but I know a lot of external build systems for Rust don't support persisting the incremental build caches from a single crate to be reused next time it's built, so your only unit of incrementalism is at the crate level.
joshka | 4 hours ago
Similarly Microsoft's: https://microsoft.github.io/rust-guidelines/ And Ed Page's: https://epage.github.io/dev/rust-style/
citbl | 2 hours ago
Do they have a Go style guide? Or is it not required for Go?
mond | 35 minutes ago
They do. Might be this here: https://google.github.io/styleguide/go/index
Interestingly, no line length caps, unlike in e.g. Google's Python and C++ style guides
fzakaria | 3 minutes ago
that part is handled by
go fmti guess?