Closed foodhype closed 9 years ago
Oddly the branch failed when I only added white space?
Hi, yes, the current rustc
gets Internal Compiler Errors on this nightly when building, so all things will fail miserably.
I've been struggling to determine a good spacing regime. This is definitely easier to read.
I'm currently integrating MIO in, I will try to follow this style and try to make spacing better when I do that and close this after. Thanks!
PS: What do you suggest for handling long lines as an indentation scheme for impl
s?
The closest thing we have to a standard line wrapping convention in Rust is http://aturon.github.io/style/whitespace.html in the section titled "Line wrapping." The second closest thing is the Google C++ style guide. Based on those, it seems you could go with one of two conventions:
(1) Wrap to a new line with twice as many spaces as your standard indentation. So, since your standard indentation is four spaces, you would continue to a new line with an indentation of eight spaces.
At Google, a common recommendation with this convention is to break your line at a syntactic level rather than simply breaking after the max line length. For example:
foo.someReallyLongFunctionNameWithManyArguments(
________alpha, bravo, charlie, unicorn);
is better than
foo.someReallyLongFunctionNameWithManyArguments(alpha,
________bravo, charlie, unicorn);
(2) Wrap to a new line by indenting to the same level as any previous elements at the same syntactic level. For example:
fn someReallyLongFunction(alpha: A, bravo: B, charlie: C,
_______________________delta: D, unicorn: U) -> T {
...
}
The important thing is not so much which convention you use as long as the convention is consistent.
We've improved this in our refactoring. Thank you!
I had trouble reading most of the code, because of blank space conventions. I suggest adding one blank space between top-level constructs, non-trivial functions, and functions exceeding one line. Note that this is only a suggestion, since Rust hasn't established blank space conventions; however, this is the convention I've followed based on the Google C++ style guide and cpplint.