File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -328,6 +328,8 @@ Do not put a space between an argument, and the comma which follows.
328
328
329
329
Do put a space between an argument, and the comma which precedes it.
330
330
331
+ Prefer not to break a line in the callee expression.
332
+
331
333
#### Single-line calls
332
334
333
335
Do not put a space between the function name and open paren, between the open
@@ -339,18 +341,33 @@ Do not put a comma after the last argument.
339
341
foo (x , y , z )
340
342
```
341
343
344
+ #### Multi-line calls
345
+
346
+ If the function call is not * small* , it would otherwise over-run the max width,
347
+ or any argument or the callee is multi-line, then the call should be formatted
348
+ across multiple lines. In this case, each argument should be on it's own block-
349
+ indented line, there should be a newline after the opening parenthesis and
350
+ before the closing parenthesis, and there should be a trailing comma. E.g.,
351
+
352
+ ``` rust
353
+ a_function_call (
354
+ arg1 ,
355
+ a_nested_call (a , b ),
356
+ )
357
+ ```
358
+
359
+
342
360
### Method calls
343
361
344
362
Follow the function rules for calling.
345
363
346
- #### Single-line
347
-
348
364
Do not put any spaces around the ` . ` .
349
365
350
366
``` rust
351
367
x . foo (). bar (). baz (x , y , z );
352
368
```
353
369
370
+
354
371
### Casts (` as ` )
355
372
356
373
Put spaces before and after ` as ` :
@@ -360,6 +377,7 @@ let cstr = "Hi\0" as *const str as *const [u8] as *const std::os::raw::c_char;
360
377
```
361
378
362
379
380
+
363
381
### Match
364
382
365
383
Prefer not to line-break inside the discriminant expression. There must always
You can’t perform that action at this time.
0 commit comments