diff options
| author | topecongiro <seuchida@gmail.com> | 2017-06-04 15:23:00 +0900 |
|---|---|---|
| committer | topecongiro <seuchida@gmail.com> | 2017-06-04 19:37:24 +0900 |
| commit | b49269ad399e33c5c5ea2cd9a01376221ea2c62e (patch) | |
| tree | ea7555694c54e30ca6d39cb8ebd54071eb64940b /src/expr.rs | |
| parent | fabbef2c3eaad7326e60cbb7c4c818bfaccb3178 (diff) | |
Forbid method chain to get combined if it uses multi line.
If the method chain goes multi line before the last element, disallow combining the method chain.
Diffstat (limited to 'src/expr.rs')
| -rw-r--r-- | src/expr.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/expr.rs b/src/expr.rs index 0ec459f8e19..46e030bd094 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1784,6 +1784,11 @@ fn try_overflow_last_arg(context: &RewriteContext, // Replace the last item with its first line to see if it fits with // first arguments. let (orig_last, placeholder) = if overflow_last { + let mut context = context.clone(); + match args[args.len() - 1].node { + ast::ExprKind::MethodCall(..) => context.force_one_line_chain = true, + _ => (), + } last_arg_shape(&context, &item_vec, shape).map_or((None, None), |arg_shape| { rewrite_last_arg_with_overflow(&context, &args[args.len() - 1], |
