diff options
| author | Marcus Klaas de Vries <mail@marcusklaas.nl> | 2016-03-24 14:57:24 +0100 |
|---|---|---|
| committer | Marcus Klaas de Vries <mail@marcusklaas.nl> | 2016-03-24 14:57:24 +0100 |
| commit | 8fd95df54ab5de3dddfd47d8ae9fc52fea803844 (patch) | |
| tree | ab37e6eb43e62a29ac7f06329f42524708659cd2 /src | |
| parent | ca757183fedf8e89286372b91ca074c11d99c4f4 (diff) | |
| parent | 9d8ce544283fd18cf1bfd6285a9dcce19aabbfea (diff) | |
Merge pull request #868 from rust-lang-nursery/tuple-wide
Don't apply the function args heuristic to tuple lits.
Diffstat (limited to 'src')
| -rw-r--r-- | src/chains.rs | 3 | ||||
| -rw-r--r-- | src/comment.rs | 4 | ||||
| -rw-r--r-- | src/expr.rs | 11 | ||||
| -rw-r--r-- | src/items.rs | 4 |
4 files changed, 7 insertions, 15 deletions
diff --git a/src/chains.rs b/src/chains.rs index 191b4a2ea4c..c535287df24 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -236,8 +236,7 @@ fn rewrite_method_call(method_name: ast::Ident, .map(|ty| ty.rewrite(context, width, offset)) .collect()); - (types.last().unwrap().span.hi, - format!("::<{}>", type_list.join(", "))) + (types.last().unwrap().span.hi, format!("::<{}>", type_list.join(", "))) }; let callee_str = format!(".{}{}", method_name, type_str); diff --git a/src/comment.rs b/src/comment.rs index 3382ab53276..232e7691b82 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -501,9 +501,7 @@ impl<'a> Iterator for CommentCodeSlices<'a> { CodeCharKind::Comment => CodeCharKind::Normal, CodeCharKind::Normal => CodeCharKind::Comment, }; - let res = (kind, - self.last_slice_end, - &self.slice[self.last_slice_end..sub_slice_end]); + let res = (kind, self.last_slice_end, &self.slice[self.last_slice_end..sub_slice_end]); self.last_slice_end = sub_slice_end; self.last_slice_kind = kind; diff --git a/src/expr.rs b/src/expr.rs index 5fc0f370ab6..d933f68ce18 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -18,7 +18,7 @@ use std::fmt::Write; use {Indent, Spanned}; use rewrite::{Rewrite, RewriteContext}; use lists::{write_list, itemize_list, ListFormatting, SeparatorTactic, ListTactic, - DefinitiveListTactic, definitive_tactic, ListItem, format_fn_args}; + DefinitiveListTactic, definitive_tactic, ListItem, format_item_list}; use string::{StringFormat, rewrite_string}; use utils::{CodeMapSpanUtils, extra_offset, last_line_width, wrap_str, binary_search, first_line_width, semicolon_for_stmt}; @@ -1336,9 +1336,7 @@ fn rewrite_call_inner<R>(context: &RewriteContext, // Replace the stub with the full overflowing last argument if the rewrite // succeeded and its first line fits with the other arguments. match (overflow_last, tactic, placeholder) { - (true, - DefinitiveListTactic::Horizontal, - placeholder @ Some(..)) => { + (true, DefinitiveListTactic::Horizontal, placeholder @ Some(..)) => { item_vec[arg_count - 1].item = placeholder; } (true, _, _) => { @@ -1511,8 +1509,7 @@ fn rewrite_struct_lit<'a>(context: &RewriteContext, outer_indent)) }; - match (context.config.struct_lit_style, - context.config.struct_lit_multiline_style) { + match (context.config.struct_lit_style, context.config.struct_lit_multiline_style) { (StructLitStyle::Block, _) if fields_str.contains('\n') || fields_str.len() > h_budget => { format_on_newline() } @@ -1583,7 +1580,7 @@ pub fn rewrite_tuple<'a, I>(context: &RewriteContext, list_lo, span.hi - BytePos(1)); let budget = try_opt!(width.checked_sub(2)); - let list_str = try_opt!(format_fn_args(items, budget, indent, context.config)); + let list_str = try_opt!(format_item_list(items, budget, indent, context.config)); Some(format!("({})", list_str)) } diff --git a/src/items.rs b/src/items.rs index 04382489b28..688e4759832 100644 --- a/src/items.rs +++ b/src/items.rs @@ -1581,9 +1581,7 @@ fn compute_budgets_for_args(context: &RewriteContext, let multi_line_budget = context.config.max_width - (indent.width() + result.len() + "()".len()); - return (one_line_budget, - multi_line_budget, - indent + result.len() + 1); + return (one_line_budget, multi_line_budget, indent + result.len() + 1); } } |
