![]() Obviously I prefer the proposed style, or at least my take on it. In the proposed style, they could be used like this fn very_long_function(&mut self, long_name: &T, longer_name: LongerType, In the RFC, they are used like this: fn very_long_function(&mut self, I’m guessing here how where clauses would be indented. With where clauses, the code from above could be written as fn very_long_function(&mut self, The where clauses RFC is also relevant to this discussion. Longer_name: LongerType, longest_name: U) -> Vec Proposed style: fn very_long_function(&mut self, long_name: &T, The current guidelines recommend the following: fn very_long_function( Multi-line statement, proposed style without indenting to the level of the first argument (because the brace on the next line acts as delimiter): fn very_long_function(&mut self, long_name: &LongType, longer_name: LongerType,Ĭomplicated or long type parameter lists also need to be considered. Multi-line statement, current style: fn very_long_function(&mut self, long_name: &LongType, longer_name: LongerType, I’m adding some code to the function body to make it more realistic. For single line statements, they’re both identical. Let’s compare the currently recommended style with the style being proposed. ![]() Given that, I think a rule like the one quoted would actually decrease readability in most cases.
0 Comments
Leave a Reply. |