Merge pull request #2116 from topecongiro/config-options-indent
Rename config options related to indent
This commit is contained in:
commit
f1035d9782
@ -5,7 +5,7 @@ Rustfmt is designed to be very configurable. You can create a TOML file called `
|
||||
A possible content of `rustfmt.toml` or `.rustfmt.toml` might look like this:
|
||||
|
||||
```toml
|
||||
array_layout = "Block"
|
||||
array_indent = "Block"
|
||||
array_width = 80
|
||||
reorder_imported_names = true
|
||||
```
|
||||
@ -22,7 +22,7 @@ Use this option to prevent a huge array from being vertically formatted.
|
||||
- **Default value**: `0`
|
||||
- **Possible values**: any positive integer
|
||||
|
||||
**Note:** A value of `0` results in [`array_layout`](#array_layout) being applied regardless of a line's width.
|
||||
**Note:** A value of `0` results in [`array_indent`](#array_indent) being applied regardless of a line's width.
|
||||
|
||||
#### `0` (default):
|
||||
|
||||
@ -50,7 +50,7 @@ let a = vec![
|
||||
];
|
||||
```
|
||||
|
||||
## `array_layout`
|
||||
## `array_indent`
|
||||
|
||||
Indent on arrays
|
||||
|
||||
@ -90,7 +90,7 @@ Maximum width of an array literal before falling back to vertical formatting
|
||||
- **Default value**: `60`
|
||||
- **Possible values**: any positive integer
|
||||
|
||||
**Note:** A value of `0` results in [`array_layout`](#array_layout) being applied regardless of a line's width.
|
||||
**Note:** A value of `0` results in [`array_indent`](#array_indent) being applied regardless of a line's width.
|
||||
|
||||
#### Lines shorter than `array_width`:
|
||||
```rust
|
||||
@ -98,7 +98,7 @@ let lorem = vec.
|
||||
See [`array_indent`](#array_indent).
|
||||
|
||||
## `attributes_on_same_line_as_field`
|
||||
|
||||
@ -298,7 +298,7 @@ lorem_ipsum(|| {
|
||||
});
|
||||
```
|
||||
|
||||
**Note**: This option only takes effect when `fn_call_style` is set to `"Visual"`.
|
||||
**Note**: This option only takes effect when `fn_call_indent` is set to `"Visual"`.
|
||||
|
||||
## `combine_control_expr`
|
||||
|
||||
@ -614,7 +614,7 @@ trait Lorem {
|
||||
}
|
||||
```
|
||||
|
||||
## `fn_args_layout`
|
||||
## `fn_args_indent`
|
||||
|
||||
Layout of function arguments and tuple structs
|
||||
|
||||
@ -758,7 +758,7 @@ where
|
||||
}
|
||||
```
|
||||
|
||||
## `fn_call_style`
|
||||
## `fn_call_indent`
|
||||
|
||||
Indentation for function calls, etc.
|
||||
|
||||
@ -809,7 +809,7 @@ lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "el
|
||||
|
||||
#### Function call longer than `fn_call_width`:
|
||||
|
||||
See [`fn_call_style`](#fn_call_style).
|
||||
See [`fn_call_indent`](#fn_call_indent).
|
||||
|
||||
## `fn_empty_single_line`
|
||||
|
||||
@ -874,7 +874,7 @@ fn lorem(ipsum: Ipsum,
|
||||
|
||||
```
|
||||
|
||||
**Note**: This option only takes effect when `fn_call_style` is set to `"Visual"`.
|
||||
**Note**: This option only takes effect when `fn_call_indent` is set to `"Visual"`.
|
||||
|
||||
## `fn_single_line`
|
||||
|
||||
@ -1868,9 +1868,9 @@ let lorem = Lorem {
|
||||
};
|
||||
```
|
||||
|
||||
See also: [`struct_lit_style`](#struct_lit_style), [`struct_lit_width`](#struct_lit_width).
|
||||
See also: [`struct_lit_indent`](#struct_lit_indent), [`struct_lit_width`](#struct_lit_width).
|
||||
|
||||
## `struct_lit_style`
|
||||
## `struct_lit_indent`
|
||||
|
||||
Style of struct definition
|
||||
|
||||
@ -1893,7 +1893,7 @@ let lorem = Lorem { ipsum: dolor,
|
||||
sit: amet, };
|
||||
```
|
||||
|
||||
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
|
||||
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent).
|
||||
|
||||
## `struct_lit_width`
|
||||
|
||||
@ -1910,9 +1910,9 @@ let lorem = Lorem { ipsum: dolor, sit: amet };
|
||||
```
|
||||
|
||||
#### Lines longer than `struct_lit_width`:
|
||||
See [`struct_lit_style`](#struct_lit_style).
|
||||
See [`struct_lit_indent`](#struct_lit_indent).
|
||||
|
||||
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
|
||||
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent).
|
||||
|
||||
## `struct_variant_width`
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
fn_args_layout = "Visual"
|
||||
array_layout = "Visual"
|
||||
fn_args_indent = "Visual"
|
||||
array_indent = "Visual"
|
||||
control_style = "Legacy"
|
||||
where_style = "Legacy"
|
||||
generics_indent = "Visual"
|
||||
fn_call_style = "Visual"
|
||||
fn_call_indent = "Visual"
|
||||
combine_control_expr = false
|
||||
fn_args_paren_newline = true
|
||||
|
@ -559,9 +559,9 @@ 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_layout: IndentStyle, IndentStyle::Block, false, "Indent on arrays";
|
||||
array_indent: IndentStyle, IndentStyle::Block, false, "Indent on arrays";
|
||||
array_width: usize, 60, false,
|
||||
"Maximum width of an array literal before falling back to vertical formatting";
|
||||
array_horizontal_layout_threshold: usize, 0, false,
|
||||
@ -578,10 +578,10 @@ create_config! {
|
||||
where_pred_indent: IndentStyle, IndentStyle::Visual, false,
|
||||
"Indentation style of a where predicate";
|
||||
generics_indent: IndentStyle, IndentStyle::Block, false, "Indentation of generics";
|
||||
struct_lit_style: IndentStyle, IndentStyle::Block, false, "Style of struct definition";
|
||||
struct_lit_indent: IndentStyle, IndentStyle::Block, false, "Style of struct definition";
|
||||
struct_lit_multiline_style: MultilineStyle, MultilineStyle::PreferSingle, false,
|
||||
"Multiline style on literal structs";
|
||||
fn_call_style: IndentStyle, IndentStyle::Block, false, "Indentation for function calls, etc.";
|
||||
fn_call_indent: IndentStyle, IndentStyle::Block, false, "Indentation for function calls, etc.";
|
||||
report_todo: ReportTactic, ReportTactic::Never, false,
|
||||
"Report all, none or unnumbered occurrences of TODO in source file comments";
|
||||
report_fixme: ReportTactic, ReportTactic::Never, false,
|
||||
|
22
src/expr.rs
22
src/expr.rs
@ -419,7 +419,7 @@ where
|
||||
1 // "["
|
||||
};
|
||||
|
||||
let nested_shape = match context.config.array_layout() {
|
||||
let nested_shape = match context.config.array_indent() {
|
||||
IndentStyle::Block => shape
|
||||
.block()
|
||||
.block_indent(context.config.tab_spaces())
|
||||
@ -454,7 +454,7 @@ where
|
||||
.iter()
|
||||
.any(|li| li.item.as_ref().map(|s| s.len() > 10).unwrap_or(false));
|
||||
|
||||
let mut tactic = match context.config.array_layout() {
|
||||
let mut tactic = match context.config.array_indent() {
|
||||
IndentStyle::Block => {
|
||||
// FIXME wrong shape in one-line case
|
||||
match shape.width.checked_sub(2 * bracket_size) {
|
||||
@ -477,7 +477,7 @@ where
|
||||
DefinitiveListTactic::Mixed
|
||||
},
|
||||
};
|
||||
let ends_with_newline = tactic.ends_with_newline(context.config.array_layout());
|
||||
let ends_with_newline = tactic.ends_with_newline(context.config.array_indent());
|
||||
if context.config.array_horizontal_layout_threshold() > 0
|
||||
&& items.len() > context.config.array_horizontal_layout_threshold()
|
||||
{
|
||||
@ -489,7 +489,7 @@ where
|
||||
separator: ",",
|
||||
trailing_separator: if trailing_comma {
|
||||
SeparatorTactic::Always
|
||||
} else if context.inside_macro || context.config.array_layout() == IndentStyle::Visual {
|
||||
} else if context.inside_macro || context.config.array_indent() == IndentStyle::Visual {
|
||||
SeparatorTactic::Never
|
||||
} else {
|
||||
SeparatorTactic::Vertical
|
||||
@ -502,7 +502,7 @@ where
|
||||
};
|
||||
let list_str = write_list(&items, &fmt)?;
|
||||
|
||||
let result = if context.config.array_layout() == IndentStyle::Visual
|
||||
let result = if context.config.array_indent() == IndentStyle::Visual
|
||||
|| tactic == DefinitiveListTactic::Horizontal
|
||||
{
|
||||
if context.config.spaces_within_square_brackets() && !list_str.is_empty() {
|
||||
@ -2033,7 +2033,7 @@ where
|
||||
let used_width = extra_offset(callee_str, shape);
|
||||
let one_line_width = shape.width.checked_sub(used_width + 2 * paren_overhead)?;
|
||||
|
||||
let nested_shape = shape_from_fn_call_style(
|
||||
let nested_shape = shape_from_fn_call_indent(
|
||||
context,
|
||||
shape,
|
||||
used_width + 2 * paren_overhead,
|
||||
@ -2379,7 +2379,7 @@ pub fn can_be_overflowed_expr(context: &RewriteContext, expr: &ast::Expr, args_l
|
||||
match expr.node {
|
||||
ast::ExprKind::Match(..) => {
|
||||
(context.use_block_indent() && args_len == 1)
|
||||
|| (context.config.fn_call_style() == IndentStyle::Visual && args_len > 1)
|
||||
|| (context.config.fn_call_indent() == IndentStyle::Visual && args_len > 1)
|
||||
}
|
||||
ast::ExprKind::If(..) |
|
||||
ast::ExprKind::IfLet(..) |
|
||||
@ -2391,7 +2391,7 @@ pub fn can_be_overflowed_expr(context: &RewriteContext, expr: &ast::Expr, args_l
|
||||
}
|
||||
ast::ExprKind::Block(..) | ast::ExprKind::Closure(..) => {
|
||||
context.use_block_indent()
|
||||
|| context.config.fn_call_style() == IndentStyle::Visual && args_len > 1
|
||||
|| context.config.fn_call_indent() == IndentStyle::Visual && args_len > 1
|
||||
}
|
||||
ast::ExprKind::Array(..) |
|
||||
ast::ExprKind::Call(..) |
|
||||
@ -2640,7 +2640,7 @@ fn rewrite_struct_lit<'a>(
|
||||
let fields_str = wrap_struct_field(context, &fields_str, shape, v_shape, one_line_width);
|
||||
Some(format!("{} {{{}}}", path_str, fields_str))
|
||||
|
||||
// FIXME if context.config.struct_lit_style() == Visual, but we run out
|
||||
// FIXME if context.config.struct_lit_indent() == Visual, but we run out
|
||||
// of space, we should fall back to BlockIndent.
|
||||
}
|
||||
|
||||
@ -2651,7 +2651,7 @@ pub fn wrap_struct_field(
|
||||
nested_shape: Shape,
|
||||
one_line_width: usize,
|
||||
) -> String {
|
||||
if context.config.struct_lit_style() == IndentStyle::Block
|
||||
if context.config.struct_lit_indent() == IndentStyle::Block
|
||||
&& (fields_str.contains('\n')
|
||||
|| context.config.struct_lit_multiline_style() == MultilineStyle::ForceMulti
|
||||
|| fields_str.len() > one_line_width)
|
||||
@ -2722,7 +2722,7 @@ pub fn rewrite_field(
|
||||
}
|
||||
}
|
||||
|
||||
fn shape_from_fn_call_style(
|
||||
fn shape_from_fn_call_indent(
|
||||
context: &RewriteContext,
|
||||
shape: Shape,
|
||||
overhead: usize,
|
||||
|
20
src/items.rs
20
src/items.rs
@ -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'))
|
||||
{
|
||||
@ -1770,13 +1770,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));
|
||||
}
|
||||
@ -1823,7 +1823,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();
|
||||
@ -1864,7 +1864,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,
|
||||
@ -2149,7 +2149,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)
|
||||
}
|
||||
@ -2186,7 +2186,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,
|
||||
};
|
||||
@ -2236,7 +2236,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))
|
||||
@ -2254,7 +2254,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 ` {`.
|
||||
|
@ -737,7 +737,7 @@ pub fn struct_lit_shape(
|
||||
prefix_width: usize,
|
||||
suffix_width: usize,
|
||||
) -> Option<(Option<Shape>, Shape)> {
|
||||
let v_shape = match context.config.struct_lit_style() {
|
||||
let v_shape = match context.config.struct_lit_indent() {
|
||||
IndentStyle::Visual => shape
|
||||
.visual_indent(0)
|
||||
.shrink_left(prefix_width)?
|
||||
@ -766,7 +766,7 @@ pub fn struct_lit_tactic(
|
||||
items: &[ListItem],
|
||||
) -> DefinitiveListTactic {
|
||||
if let Some(h_shape) = h_shape {
|
||||
let prelim_tactic = match (context.config.struct_lit_style(), items.len()) {
|
||||
let prelim_tactic = match (context.config.struct_lit_indent(), items.len()) {
|
||||
(IndentStyle::Visual, 1) => ListTactic::HorizontalVertical,
|
||||
_ => context.config.struct_lit_multiline_style().to_list_tactic(),
|
||||
};
|
||||
@ -797,7 +797,7 @@ pub fn struct_lit_formatting<'a>(
|
||||
context: &'a RewriteContext,
|
||||
force_no_trailing_comma: bool,
|
||||
) -> ListFormatting<'a> {
|
||||
let ends_with_newline = context.config.struct_lit_style() != IndentStyle::Visual
|
||||
let ends_with_newline = context.config.struct_lit_indent() != IndentStyle::Visual
|
||||
&& tactic == DefinitiveListTactic::Vertical;
|
||||
ListFormatting {
|
||||
tactic: tactic,
|
||||
|
@ -43,7 +43,7 @@ impl<'a> RewriteContext<'a> {
|
||||
|
||||
/// Return true if we should use block indent style for rewriting function call.
|
||||
pub fn use_block_indent(&self) -> bool {
|
||||
self.config.fn_call_style() == IndentStyle::Block || self.use_block
|
||||
self.config.fn_call_indent() == IndentStyle::Block || self.use_block
|
||||
}
|
||||
|
||||
pub fn budget(&self, used_width: usize) -> usize {
|
||||
|
@ -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()
|
||||
@ -357,14 +357,14 @@ where
|
||||
},
|
||||
separator_place: SeparatorPlace::Back,
|
||||
shape: list_shape,
|
||||
ends_with_newline: tactic.ends_with_newline(context.config.fn_call_style()),
|
||||
ends_with_newline: tactic.ends_with_newline(context.config.fn_call_indent()),
|
||||
preserve_newline: true,
|
||||
config: context.config,
|
||||
};
|
||||
|
||||
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)?,
|
||||
};
|
||||
|
@ -6,13 +6,13 @@ 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"
|
||||
generics_indent = "Visual"
|
||||
trailing_comma = "Vertical"
|
||||
struct_lit_style = "Block"
|
||||
struct_lit_indent = "Block"
|
||||
report_todo = "Always"
|
||||
report_fixme = "Never"
|
||||
reorder_imports = false
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
// rustfmt-generics_indent: Block
|
||||
// rustfmt-where_style: Rfc
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
|
||||
// #1547
|
||||
fuzz_target!(|data: &[u8]| if let Some(first) = data.first() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-array_horizontal_layout_threshold: 1000
|
||||
// rustfmt-array_layout: Visual
|
||||
// rustfmt-array_indent: Visual
|
||||
|
||||
const ARRAY: [u8; 2048] =
|
||||
[99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116,
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-array_layout: Block
|
||||
// rustfmt-array_indent: Block
|
||||
// Array layout
|
||||
|
||||
fn main() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-array_layout: Visual
|
||||
// rustfmt-array_indent: Visual
|
||||
// Array layout
|
||||
|
||||
fn main() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
// Function arguments layout
|
||||
|
||||
fn lorem() {}
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout: Visual
|
||||
// rustfmt-fn_args_indent: Visual
|
||||
// Function arguments layout
|
||||
|
||||
fn lorem() {}
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
|
||||
// rustfmt should not add trailing comma when rewriting macro. See #1528.
|
||||
fn a() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
// Function call style
|
||||
|
||||
fn main() {
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-fn_call_style: Visual
|
||||
// rustfmt-fn_call_indent: Visual
|
||||
|
||||
// rustfmt should not add trailing comma when rewriting macro. See #1528.
|
||||
fn a() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_call_style: Visual
|
||||
// rustfmt-fn_call_indent: Visual
|
||||
// Function call style
|
||||
|
||||
fn main() {
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-fn_call_width: 0
|
||||
// rustfmt-fn_call_style: block
|
||||
// rustfmt-fn_call_indent: block
|
||||
|
||||
// #1508
|
||||
fn a() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Block
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-struct_lit_style: Block
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
@ -1,6 +1,6 @@
|
||||
// rustfmt-tab_spaces: 2
|
||||
// rustfmt-max_width: 30
|
||||
// rustfmt-array_layout: Block
|
||||
// rustfmt-array_indent: Block
|
||||
// Tab spaces
|
||||
|
||||
fn lorem() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// rustfmt-tab_spaces: 4
|
||||
// rustfmt-max_width: 30
|
||||
// rustfmt-array_layout: Block
|
||||
// rustfmt-array_indent: Block
|
||||
// Tab spaces
|
||||
|
||||
fn lorem() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-array_layout: Block
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-array_indent: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
// rustfmt-control_style: Rfc
|
||||
// Test expressions with block formatting.
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
// rustfmt-fn_brace_style: PreferSameLine
|
||||
// Test different indents.
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
// rustfmt-fn_brace_style: PreferSameLine
|
||||
// Test different indents.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
|
||||
fn foo() {
|
||||
foo();
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout = "block"
|
||||
// rustfmt-fn_args_indent = "block"
|
||||
|
||||
#![feature(pub_restricted)]
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
// Struct literal expressions.
|
||||
|
@ -1,6 +1,6 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// rustfmt-struct_lit_multiline_style: ForceMulti
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
fn foo() {
|
||||
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b());
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
// rustfmt-generics_indent: Block
|
||||
// rustfmt-where_style: Rfc
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
|
||||
// #1547
|
||||
fuzz_target!(|data: &[u8]| if let Some(first) = data.first() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-array_horizontal_layout_threshold: 1000
|
||||
// rustfmt-array_layout: Visual
|
||||
// rustfmt-array_indent: Visual
|
||||
|
||||
const ARRAY: [u8; 2048] =
|
||||
[99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116, 21, 18, 37,
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-array_layout: Block
|
||||
// rustfmt-array_indent: Block
|
||||
// Array layout
|
||||
|
||||
fn main() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-array_layout: Visual
|
||||
// rustfmt-array_indent: Visual
|
||||
// Array layout
|
||||
|
||||
fn main() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
// rustfmt-combine_control_expr: false
|
||||
// Combining openings and closings. See https://github.com/rust-lang-nursery/fmt-rfcs/issues/61.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
// rustfmt-combine_control_expr: true
|
||||
// Combining openings and closings. See https://github.com/rust-lang-nursery/fmt-rfcs/issues/61.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
// Function arguments layout
|
||||
|
||||
fn lorem() {}
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout: Visual
|
||||
// rustfmt-fn_args_indent: Visual
|
||||
// Function arguments layout
|
||||
|
||||
fn lorem() {}
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
// rustfmt-max_width: 80
|
||||
// rustfmt-tab_spaces: 2
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
|
||||
// rustfmt should not add trailing comma when rewriting macro. See #1528.
|
||||
fn a() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
// Function call style
|
||||
|
||||
fn main() {
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-fn_call_style: Visual
|
||||
// rustfmt-fn_call_indent: Visual
|
||||
|
||||
// rustfmt should not add trailing comma when rewriting macro. See #1528.
|
||||
fn a() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_call_style: Visual
|
||||
// rustfmt-fn_call_indent: Visual
|
||||
// Function call style
|
||||
|
||||
fn main() {
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-fn_call_width: 0
|
||||
// rustfmt-fn_call_style: block
|
||||
// rustfmt-fn_call_indent: block
|
||||
|
||||
// #1508
|
||||
fn a() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-struct_lit_style: Block
|
||||
// rustfmt-struct_lit_indent: Block
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
@ -1,6 +1,6 @@
|
||||
// rustfmt-tab_spaces: 2
|
||||
// rustfmt-max_width: 30
|
||||
// rustfmt-array_layout: Block
|
||||
// rustfmt-array_indent: Block
|
||||
// Tab spaces
|
||||
|
||||
fn lorem() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// rustfmt-tab_spaces: 4
|
||||
// rustfmt-max_width: 30
|
||||
// rustfmt-array_layout: Block
|
||||
// rustfmt-array_indent: Block
|
||||
// Tab spaces
|
||||
|
||||
fn lorem() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-array_layout: Block
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-array_indent: Block
|
||||
// rustfmt-fn_call_indent: Block
|
||||
// rustfmt-control_style: Rfc
|
||||
// Test expressions with block formatting.
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
// rustfmt-fn_brace_style: PreferSameLine
|
||||
// Test different indents.
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
// rustfmt-fn_brace_style: PreferSameLine
|
||||
// Test different indents.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
|
||||
fn foo() {
|
||||
foo();
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout = "block"
|
||||
// rustfmt-fn_args_indent = "block"
|
||||
|
||||
#![feature(pub_restricted)]
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// rustfmt-fn_args_indent: Block
|
||||
// rustfmt-fn_args_paren_newline: false
|
||||
|
||||
// #1624
|
||||
|
@ -1,6 +1,6 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
// Struct literal expressions.
|
||||
|
@ -1,6 +1,6 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// rustfmt-struct_lit_multiline_style: ForceMulti
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
fn foo() {
|
||||
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b());
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user