Rename 'fn_args_layout' to 'fn_args_indent'

This commit is contained in:
topecongiro 2017-11-04 22:45:47 +09:00
parent 5096cdff56
commit 55c2000d94
29 changed files with 39 additions and 39 deletions

View File

@ -614,7 +614,7 @@ trait Lorem {
}
```
## `fn_args_layout`
## `fn_args_indent`
Layout of function arguments and tuple structs

View File

@ -1,4 +1,4 @@
fn_args_layout = "Visual"
fn_args_indent = "Visual"
array_indent = "Visual"
control_style = "Legacy"
where_style = "Legacy"

View File

@ -559,7 +559,7 @@ create_config! {
"Location of return type in function declaration";
fn_args_paren_newline: bool, false, false, "If function argument parenthesis goes on a newline";
fn_args_density: Density, Density::Tall, false, "Argument density in functions";
fn_args_layout: IndentStyle, IndentStyle::Block, false,
fn_args_indent: IndentStyle, IndentStyle::Block, false,
"Layout of function arguments and tuple structs";
array_indent: IndentStyle, IndentStyle::Block, false, "Indent on arrays";
array_width: usize, 60, false,

View File

@ -933,8 +933,8 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
let has_body = !trait_items.is_empty();
let where_density = if (context.config.where_density() == Density::Compressed
&& (!result.contains('\n') || context.config.fn_args_layout() == IndentStyle::Block))
|| (context.config.fn_args_layout() == IndentStyle::Block && result.is_empty())
&& (!result.contains('\n') || context.config.fn_args_indent() == IndentStyle::Block))
|| (context.config.fn_args_indent() == IndentStyle::Block && result.is_empty())
|| (context.config.where_density() == Density::CompressedIfEmpty && !has_body
&& !result.contains('\n'))
{
@ -1746,13 +1746,13 @@ fn rewrite_fn_base(
} else if context.config.fn_args_paren_newline() {
result.push('\n');
result.push_str(&arg_indent.to_string(context.config));
if context.config.fn_args_layout() == IndentStyle::Visual {
if context.config.fn_args_indent() == IndentStyle::Visual {
arg_indent = arg_indent + 1; // extra space for `(`
}
result.push('(');
} else {
result.push_str("(");
if context.config.fn_args_layout() == IndentStyle::Visual {
if context.config.fn_args_indent() == IndentStyle::Visual {
result.push('\n');
result.push_str(&arg_indent.to_string(context.config));
}
@ -1805,7 +1805,7 @@ fn rewrite_fn_base(
generics_str.contains('\n'),
)?;
let put_args_in_block = match context.config.fn_args_layout() {
let put_args_in_block = match context.config.fn_args_indent() {
IndentStyle::Block => arg_str.contains('\n') || arg_str.len() > one_line_budget,
_ => false,
} && !fd.inputs.is_empty();
@ -1846,7 +1846,7 @@ fn rewrite_fn_base(
// Return type.
if let ast::FunctionRetTy::Ty(..) = fd.output {
let ret_should_indent = match context.config.fn_args_layout() {
let ret_should_indent = match context.config.fn_args_indent() {
// If our args are block layout then we surely must have space.
IndentStyle::Block if put_args_in_block || fd.inputs.is_empty() => false,
_ if args_last_line_contains_comment => false,
@ -2131,7 +2131,7 @@ fn rewrite_args(
.and_then(|item| item.post_comment.as_ref())
.map_or(false, |s| s.trim().starts_with("//"));
let (indent, trailing_comma) = match context.config.fn_args_layout() {
let (indent, trailing_comma) = match context.config.fn_args_indent() {
IndentStyle::Block if fits_in_one_line => {
(indent.block_indent(context.config), SeparatorTactic::Never)
}
@ -2168,7 +2168,7 @@ fn rewrite_args(
},
separator_place: SeparatorPlace::Back,
shape: Shape::legacy(budget, indent),
ends_with_newline: tactic.ends_with_newline(context.config.fn_args_layout()),
ends_with_newline: tactic.ends_with_newline(context.config.fn_args_indent()),
preserve_newline: true,
config: context.config,
};
@ -2218,7 +2218,7 @@ fn compute_budgets_for_args(
if one_line_budget > 0 {
// 4 = "() {".len()
let (indent, multi_line_budget) = match context.config.fn_args_layout() {
let (indent, multi_line_budget) = match context.config.fn_args_indent() {
IndentStyle::Block => {
let indent = indent.block_indent(context.config);
(indent, context.budget(indent.width() + 1))
@ -2236,7 +2236,7 @@ fn compute_budgets_for_args(
// Didn't work. we must force vertical layout and put args on a newline.
let new_indent = indent.block_indent(context.config);
let used_space = match context.config.fn_args_layout() {
let used_space = match context.config.fn_args_indent() {
// 1 = `,`
IndentStyle::Block => new_indent.width() + 1,
// Account for `)` and possibly ` {`.

View File

@ -302,7 +302,7 @@ where
// 2 for ()
let budget = shape.width.checked_sub(2)?;
// 1 for (
let offset = match context.config.fn_args_layout() {
let offset = match context.config.fn_args_indent() {
IndentStyle::Block => {
shape
.block()
@ -364,7 +364,7 @@ where
let list_str = write_list(&item_vec, &fmt)?;
let ty_shape = match context.config.fn_args_layout() {
let ty_shape = match context.config.fn_args_indent() {
IndentStyle::Block => shape.block().block_indent(context.config.tab_spaces()),
IndentStyle::Visual => shape.block_left(4)?,
};

View File

@ -6,7 +6,7 @@ fn_brace_style = "SameLineWhere"
fn_return_indent = "WithArgs"
fn_args_paren_newline = true
fn_args_density = "Tall"
fn_args_layout = "Visual"
fn_args_indent = "Visual"
where_density = "Tall"
where_layout = "Vertical"
where_pred_indent = "Visual"

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-fn_call_style: Block
// rustfmt-generics_indent: Block
// rustfmt-where_style: Rfc

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// Function arguments layout
fn lorem() {}

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Visual
// rustfmt-fn_args_indent: Visual
// Function arguments layout
fn lorem() {}

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-generics_indent: Block
// rustfmt-where_layout: Mixed
// Test different indents.

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-generics_indent: Block
// rustfmt-where_layout: HorizontalVertical
// Test different indents.

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-fn_brace_style: PreferSameLine
// Test different indents.

View File

@ -1,5 +1,5 @@
// rustfmt-normalize_comments: true
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-fn_args_density: Vertical
// rustfmt-fn_brace_style: AlwaysNextLine

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-fn_brace_style: PreferSameLine
// Test different indents.

View File

@ -1,5 +1,5 @@
// rustfmt-normalize_comments: true
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
fn foo() {
foo();

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout = "block"
// rustfmt-fn_args_indent = "block"
#![feature(pub_restricted)]

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-where_style: Rfc
fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape) where T: FOo, U: Bar {

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-fn_call_style: Block
// rustfmt-generics_indent: Block
// rustfmt-where_style: Rfc

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// Function arguments layout
fn lorem() {}

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Visual
// rustfmt-fn_args_indent: Visual
// Function arguments layout
fn lorem() {}

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-generics_indent: Block
// rustfmt-where_layout: Mixed
// Test different indents.

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-generics_indent: Block
// rustfmt-where_layout: HorizontalVertical
// Test different indents.

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-fn_brace_style: PreferSameLine
// Test different indents.

View File

@ -1,5 +1,5 @@
// rustfmt-normalize_comments: true
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-fn_args_density: Vertical
// rustfmt-fn_brace_style: AlwaysNextLine

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-fn_brace_style: PreferSameLine
// Test different indents.

View File

@ -1,5 +1,5 @@
// rustfmt-normalize_comments: true
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
fn foo() {
foo();

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout = "block"
// rustfmt-fn_args_indent = "block"
#![feature(pub_restricted)]

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-fn_args_paren_newline: false
// #1624

View File

@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Block
// rustfmt-fn_args_indent: Block
// rustfmt-where_style: Rfc
fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)