-
Notifications
You must be signed in to change notification settings - Fork 898
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
fn_call_layout
configuration option
Closes 5218 The `fn_call_layout` was added to give users more control over how function calls are formatted. This change will only impact function calls, and will not have any affect on method calls. The values are identical to those for `fn_args_layout`, which is a stable option that controls how function declarations are laid out.
- Loading branch information
Showing
16 changed files
with
584 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1484,6 +1484,7 @@ fn format_tuple_struct( | |
mk_sp(lo, span.hi()), | ||
context.config.fn_call_width(), | ||
None, | ||
None, | ||
)?; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -494,6 +494,7 @@ fn rewrite_tuple_pat( | |
} else { | ||
None | ||
}, | ||
None, | ||
) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// rustfmt-fn_call_layout:Compressed | ||
|
||
fn main() { | ||
empty_args(); | ||
single_arg(ipsum); | ||
two_args(ipsum, dolor); | ||
|
||
lorem(ipsum, dolor, sit, amet); | ||
lorem(ipsum, // some inine comment | ||
dolor, sit, amet); | ||
lorem(ipsum, /* some inine comment */ | ||
dolor, sit, amet); | ||
ipsum(dolor, sit, amet, consectetur, adipiscing, elit, vivamus, ipsum, orci, rhoncus, vel, imperdiet); | ||
|
||
// issue 2010 | ||
let a = i8x32::new( | ||
0, 1, -1, 2, | ||
-2, 3, -3, 4, | ||
-4, 5, -5, std::i8::MAX, | ||
std::i8::MIN + 1, 100, -100, -32, | ||
0, 1, -1, 2, | ||
-2, 3, -3, 4, | ||
-4, 5, -5, std::i8::MAX, | ||
std::i8::MIN + 1, 100, -100, -32); | ||
|
||
// issue 4146 | ||
return_monitor_err( | ||
e, | ||
channel_state, | ||
chan, | ||
order, | ||
commitment_update.is_some(), | ||
revoke_and_ack.is_some(), | ||
); | ||
|
||
|
||
// other examples with more complex args | ||
more_complex_args( | ||
|a, b, c| {if a == 998765390 {- b * 3 } else {c} }, | ||
std::ops::Range { start: 3, end: 5 }, | ||
std::i8::MAX, String::from(" hello world!!").as_bytes(), | ||
thread::Builder::new() | ||
.name("thread1".to_string()) | ||
.spawn(move || { | ||
use std::sync::Arc; | ||
|
||
let mut values = Arc::<[u32]>::new_uninit_slice(3); | ||
|
||
// Deferred initialization: | ||
let data = Arc::get_mut(&mut values).unwrap(); | ||
data[0].write(1); | ||
data[1].write(2); | ||
data[2].write(3); | ||
|
||
let values = unsafe { values.assume_init() }; | ||
}), "another argument" | ||
) | ||
} |
Oops, something went wrong.