mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-16 22:16:53 +00:00
Remove legacy option fn_return_indent
This commit is contained in:
parent
d0f12b8ec8
commit
4f65124422
@ -991,48 +991,6 @@ fn lorem() {
|
||||
|
||||
See also [`control_brace_style`](#control_brace_style).
|
||||
|
||||
## `fn_return_indent`
|
||||
|
||||
Location of return type in function declaration
|
||||
|
||||
- **Default value**: `"WithArgs"`
|
||||
- **Possible values**: `"WithArgs"`, `"WithWhereClause"`
|
||||
|
||||
#### `"WithArgs"` (default):
|
||||
|
||||
```rust
|
||||
fn lorem(ipsum: Ipsum,
|
||||
dolor: Dolor,
|
||||
sit: Sit,
|
||||
amet: Amet,
|
||||
consectetur: Consectetur,
|
||||
adipiscing: Adipiscing)
|
||||
-> Elit
|
||||
where Ipsum: Eq
|
||||
{
|
||||
// body
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### `"WithWhereClause"`:
|
||||
|
||||
```rust
|
||||
fn lorem(ipsum: Ipsum,
|
||||
dolor: Dolor,
|
||||
sit: Sit,
|
||||
amet: Amet,
|
||||
consectetur: Consectetur,
|
||||
adipiscing: Adipiscing)
|
||||
-> Elit
|
||||
where Ipsum: Eq
|
||||
{
|
||||
// body
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**Note**: This option only takes effect when `indent_style` is set to `"Visual"`.
|
||||
|
||||
## `fn_single_line`
|
||||
|
||||
|
@ -63,14 +63,6 @@ configuration_option_enum! { ControlBraceStyle:
|
||||
AlwaysNextLine,
|
||||
}
|
||||
|
||||
// How to indent a function's return type.
|
||||
configuration_option_enum! { ReturnIndent:
|
||||
// Aligned with the arguments
|
||||
WithArgs,
|
||||
// Aligned with the where clause
|
||||
WithWhereClause,
|
||||
}
|
||||
|
||||
configuration_option_enum! { IndentStyle:
|
||||
// First line on the same line as the opening brace, all lines aligned with
|
||||
// the first line.
|
||||
@ -557,8 +549,6 @@ create_config! {
|
||||
"Add trailing semicolon after break, continue and return";
|
||||
fn_empty_single_line: bool, true, false, "Put empty-body functions on a single line";
|
||||
fn_single_line: bool, false, false, "Put single-expression functions on a single line";
|
||||
fn_return_indent: ReturnIndent, ReturnIndent::WithArgs, false,
|
||||
"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";
|
||||
array_width: usize, 60, false,
|
||||
|
14
src/items.rs
14
src/items.rs
@ -22,7 +22,7 @@ use spanned::Spanned;
|
||||
use codemap::{LineRangeUtils, SpanUtils};
|
||||
use comment::{combine_strs_with_missing_comments, contains_comment, recover_comment_removed,
|
||||
recover_missing_comment_in_span, rewrite_missing_comment, FindUncommented};
|
||||
use config::{BraceStyle, Config, Density, IndentStyle, ReturnIndent};
|
||||
use config::{BraceStyle, Config, Density, IndentStyle};
|
||||
use expr::{choose_rhs, format_expr, is_empty_block, is_simple_block_stmt, rewrite_assign_rhs,
|
||||
rewrite_call_inner, ExprType};
|
||||
use lists::{definitive_tactic, itemize_list, write_list, DefinitiveListTactic, ListFormatting,
|
||||
@ -1979,17 +1979,15 @@ fn rewrite_fn_base(
|
||||
}
|
||||
};
|
||||
let ret_indent = if ret_should_indent {
|
||||
let indent = match context.config.fn_return_indent() {
|
||||
ReturnIndent::WithWhereClause => indent + 4,
|
||||
let indent = if arg_str.is_empty() {
|
||||
// Aligning with non-existent args looks silly.
|
||||
_ if arg_str.is_empty() => {
|
||||
force_new_line_for_brace = true;
|
||||
indent + 4
|
||||
}
|
||||
force_new_line_for_brace = true;
|
||||
indent + 4
|
||||
} else {
|
||||
// FIXME: we might want to check that using the arg indent
|
||||
// doesn't blow our budget, and if it does, then fallback to
|
||||
// the where clause indent.
|
||||
_ => arg_indent,
|
||||
arg_indent
|
||||
};
|
||||
|
||||
result.push('\n');
|
||||
|
@ -3,7 +3,6 @@ comment_width = 80
|
||||
tab_spaces = 2
|
||||
newline_style = "Unix"
|
||||
brace_style = "SameLineWhere"
|
||||
fn_return_indent = "WithArgs"
|
||||
fn_args_paren_newline = true
|
||||
fn_args_density = "Tall"
|
||||
where_density = "Tall"
|
||||
|
@ -1,6 +0,0 @@
|
||||
// rustfmt-fn_return_indent: WithArgs
|
||||
// Function return type indent
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur, adipiscing: Adipiscing) -> Elit where Ipsum: Eq {
|
||||
// body
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
// rustfmt-fn_return_indent: WithWhereClause
|
||||
// Function return type indent
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur, adipiscing: Adipiscing) -> Elit where Ipsum: Eq {
|
||||
// body
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
// rustfmt-fn_return_indent: WithArgs
|
||||
// Function return type indent
|
||||
|
||||
fn lorem(
|
||||
ipsum: Ipsum,
|
||||
dolor: Dolor,
|
||||
sit: Sit,
|
||||
amet: Amet,
|
||||
consectetur: Consectetur,
|
||||
adipiscing: Adipiscing,
|
||||
) -> Elit
|
||||
where
|
||||
Ipsum: Eq,
|
||||
{
|
||||
// body
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
// rustfmt-fn_return_indent: WithWhereClause
|
||||
// Function return type indent
|
||||
|
||||
fn lorem(
|
||||
ipsum: Ipsum,
|
||||
dolor: Dolor,
|
||||
sit: Sit,
|
||||
amet: Amet,
|
||||
consectetur: Consectetur,
|
||||
adipiscing: Adipiscing,
|
||||
) -> Elit
|
||||
where
|
||||
Ipsum: Eq,
|
||||
{
|
||||
// body
|
||||
}
|
Loading…
Reference in New Issue
Block a user