diff options
| author | topecongiro <seuchida@gmail.com> | 2017-05-26 16:34:58 +0900 |
|---|---|---|
| committer | topecongiro <seuchida@gmail.com> | 2017-05-26 16:34:58 +0900 |
| commit | b748fe8bec300afb4eb6b7923c74152c588a5eb8 (patch) | |
| tree | 82c2ee7dd2b55fd51d3a00b24a93fa0c249e07cb /src/expr.rs | |
| parent | 3d135ebba473afd378fd08d25e9caad8deaea8d3 (diff) | |
Set inside_macro to false when rewriting args of macro
Diffstat (limited to 'src/expr.rs')
| -rw-r--r-- | src/expr.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/expr.rs b/src/expr.rs index 318ec8e59b5..808cd06c2d2 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1678,12 +1678,14 @@ fn rewrite_call_args(context: &RewriteContext, one_line_width: usize, force_trailing_comma: bool) -> Option<(bool, String)> { + let mut item_context = context.clone(); + item_context.inside_macro = false; let items = itemize_list(context.codemap, args.iter(), ")", |item| item.span.lo, |item| item.span.hi, - |item| item.rewrite(context, shape), + |item| item.rewrite(&item_context, shape), span.lo, span.hi); let mut item_vec: Vec<_> = items.collect(); @@ -1691,7 +1693,7 @@ fn rewrite_call_args(context: &RewriteContext, // Try letting the last argument overflow to the next line with block // indentation. If its first line fits on one line with the other arguments, // we format the function arguments horizontally. - let overflow_last = can_be_overflowed(context, args); + let overflow_last = can_be_overflowed(&item_context, args); let mut orig_last = None; let mut placeholder = None; @@ -1709,7 +1711,7 @@ fn rewrite_call_args(context: &RewriteContext, } else { shape.block() }; - let rewrite = args.last().unwrap().rewrite(context, arg_shape); + let rewrite = args.last().unwrap().rewrite(&item_context, arg_shape); swap(&mut item_vec[args.len() - 1].item, &mut orig_last); if let Some(rewrite) = rewrite { |
