Replace '*_indent' with 'indent_style' in src

This commit is contained in:
topecongiro 2017-11-13 16:42:29 +09:00
parent a4e32b1853
commit 04f09c9d85
7 changed files with 68 additions and 83 deletions

View file

@ -87,7 +87,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
// Parent is the first item in the chain, e.g., `foo` in `foo.bar.baz()`.
let parent_shape = if is_block_expr(context, &parent, "\n") {
match context.config.chain_indent() {
match context.config.indent_style() {
IndentStyle::Visual => shape.visual_indent(0),
IndentStyle::Block => shape,
}
@ -105,10 +105,10 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
let (nested_shape, extend) = if !parent_rewrite_contains_newline && is_continuable(&parent) {
(
chain_indent(context, shape.add_offset(parent_rewrite.len())),
context.config.chain_indent() == IndentStyle::Visual || is_small_parent,
context.config.indent_style() == IndentStyle::Visual || is_small_parent,
)
} else if is_block_expr(context, &parent, &parent_rewrite) {
match context.config.chain_indent() {
match context.config.indent_style() {
// Try to put the first child on the same line with parent's last line
IndentStyle::Block => (parent_shape.block_indent(context.config.tab_spaces()), true),
// The parent is a block, so align the rest of the chain with the closing
@ -127,7 +127,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
let first_child_shape = if extend {
let overhead = last_line_width(&parent_rewrite);
let offset = trimmed_last_line_width(&parent_rewrite) + prefix_try_num;
match context.config.chain_indent() {
match context.config.indent_style() {
IndentStyle::Visual => parent_shape.offset_left(overhead)?,
IndentStyle::Block => parent_shape.block().offset_left(offset)?,
}
@ -172,7 +172,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
} else {
other_child_shape
};
match context.config.chain_indent() {
match context.config.indent_style() {
IndentStyle::Visual => last_shape.sub_width(shape.rhs_overhead(context.config))?,
IndentStyle::Block => last_shape,
}
@ -262,7 +262,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
let first_connector = if is_small_parent || fits_single_line
|| last_line_extendable(&parent_rewrite)
|| context.config.chain_indent() == IndentStyle::Visual
|| context.config.indent_style() == IndentStyle::Visual
{
""
} else {
@ -272,7 +272,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
let result = if is_small_parent && rewrites.len() > 1 {
let second_connector = if fits_single_line || rewrites[1] == "?"
|| last_line_extendable(&rewrites[0])
|| context.config.chain_indent() == IndentStyle::Visual
|| context.config.indent_style() == IndentStyle::Visual
{
""
} else {
@ -295,7 +295,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
)
};
let result = format!("{}{}", result, repeat_try(suffix_try_num));
if context.config.chain_indent() == IndentStyle::Visual {
if context.config.indent_style() == IndentStyle::Visual {
wrap_str(result, context.config.max_width(), shape)
} else {
Some(result)
@ -381,7 +381,7 @@ fn make_subexpr_list(expr: &ast::Expr, context: &RewriteContext) -> (ast::Expr,
}
fn chain_indent(context: &RewriteContext, shape: Shape) -> Shape {
match context.config.chain_indent() {
match context.config.indent_style() {
IndentStyle::Visual => shape.visual_indent(0),
IndentStyle::Block => shape
.block_indent(context.config.tab_spaces())

View file

@ -40,11 +40,6 @@ macro_rules! configuration_option_enum{
}
}
configuration_option_enum! { Style:
Rfc, // Follow the style RFCs style.
Legacy, // Follow the traditional Rustfmt style.
}
configuration_option_enum! { NewlineStyle:
Windows, // \r\n
Unix, // \n
@ -521,6 +516,7 @@ pub fn get_toml_path(dir: &Path) -> Result<Option<PathBuf>, Error> {
create_config! {
indent_style: IndentStyle, IndentStyle::Block, false, "How do we indent expressions or items.";
unstable_features: bool, false, true,
"Enables unstable features. Only available on nightly channel";
verbose: bool, false, false, "Use verbose output";
@ -545,7 +541,6 @@ create_config! {
fn_brace_style: BraceStyle, BraceStyle::SameLineWhere, false, "Brace style for functions";
item_brace_style: BraceStyle, BraceStyle::SameLineWhere, false,
"Brace style for structs and enums";
control_style: Style, Style::Rfc, false, "Indent style for control flow statements";
control_brace_style: ControlBraceStyle, ControlBraceStyle::AlwaysSameLine, false,
"Brace style for control flow constructs";
impl_empty_single_line: bool, true, false, "Put empty-body implementations on a single line";
@ -559,16 +554,12 @@ 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_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,
"Maximum width of an array literal before falling back to vertical formatting";
array_horizontal_layout_threshold: usize, 0, false,
"How many elements array must have before rustfmt uses horizontal layout.";
type_punctuation_density: TypeDensity, TypeDensity::Wide, false,
"Determines if '+' or '=' are wrapped in spaces in the punctuation of types";
where_style: Style, Style::Rfc, false, "Overall strategy for where clauses";
// TODO:
// 1. Should we at least try to put the where clause on the same line as the rest of the
// function decl?
@ -576,18 +567,12 @@ create_config! {
where_density: Density, Density::Vertical, false, "Density of a where clause";
where_single_line: bool, false, false, "To force single line where layout";
where_layout: ListTactic, ListTactic::Vertical, false, "Element layout inside a where clause";
where_pred_indent: IndentStyle, IndentStyle::Visual, false,
"Indentation style of a where predicate";
generics_indent: IndentStyle, IndentStyle::Block, false, "Indentation of generics";
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_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,
"Report all, none or unnumbered occurrences of FIXME in source file comments";
chain_indent: IndentStyle, IndentStyle::Block, false, "Indentation of chain";
chain_width: usize, 60, false, "Maximum length of a chain to fit on a single line";
chain_split_single_child: bool, false, false, "Split a chain with a single child if its length \
exceeds `chain_width`";

View file

@ -21,7 +21,7 @@ use closures;
use codemap::{LineRangeUtils, SpanUtils};
use comment::{combine_strs_with_missing_comments, contains_comment, recover_comment_removed,
rewrite_comment, rewrite_missing_comment, FindUncommented};
use config::{Config, ControlBraceStyle, IndentStyle, MultilineStyle, Style};
use config::{Config, ControlBraceStyle, IndentStyle, MultilineStyle};
use lists::{definitive_tactic, itemize_list, shape_for_tactic, struct_lit_formatting,
struct_lit_shape, struct_lit_tactic, write_list, DefinitiveListTactic, ListFormatting,
ListItem, ListTactic, Separator, SeparatorPlace, SeparatorTactic};
@ -366,11 +366,11 @@ where
// We have to use multiple lines.
// Re-evaluate the rhs because we have more space now:
let mut rhs_shape = match context.config.control_style() {
Style::Legacy => shape
let mut rhs_shape = match context.config.indent_style() {
IndentStyle::Visual => shape
.sub_width(pp.suffix.len() + pp.prefix.len())?
.visual_indent(pp.prefix.len()),
Style::Rfc => {
IndentStyle::Block => {
// Try to calculate the initial constraint on the right hand side.
let rhs_overhead = shape.rhs_overhead(context.config);
Shape::indented(shape.indent.block_indent(context.config), context.config)
@ -415,7 +415,7 @@ where
1 // "["
};
let nested_shape = match context.config.array_indent() {
let nested_shape = match context.config.indent_style() {
IndentStyle::Block => shape
.block()
.block_indent(context.config.tab_spaces())
@ -450,7 +450,7 @@ where
.iter()
.any(|li| li.item.as_ref().map(|s| s.len() > 10).unwrap_or(false));
let mut tactic = match context.config.array_indent() {
let mut tactic = match context.config.indent_style() {
IndentStyle::Block => {
// FIXME wrong shape in one-line case
match shape.width.checked_sub(2 * bracket_size) {
@ -473,7 +473,7 @@ where
DefinitiveListTactic::Mixed
},
};
let ends_with_newline = tactic.ends_with_newline(context.config.array_indent());
let ends_with_newline = tactic.ends_with_newline(context.config.indent_style());
if context.config.array_horizontal_layout_threshold() > 0
&& items.len() > context.config.array_horizontal_layout_threshold()
{
@ -485,7 +485,7 @@ where
separator: ",",
trailing_separator: if trailing_comma {
SeparatorTactic::Always
} else if context.inside_macro || context.config.array_indent() == IndentStyle::Visual {
} else if context.inside_macro || context.config.indent_style() == IndentStyle::Visual {
SeparatorTactic::Never
} else {
SeparatorTactic::Vertical
@ -498,7 +498,7 @@ where
};
let list_str = write_list(&items, &fmt)?;
let result = if context.config.array_indent() == IndentStyle::Visual
let result = if context.config.indent_style() == IndentStyle::Visual
|| tactic == DefinitiveListTactic::Horizontal
{
if context.config.spaces_within_square_brackets() && !list_str.is_empty() {
@ -677,9 +677,9 @@ pub fn rewrite_cond(context: &RewriteContext, expr: &ast::Expr, shape: Shape) ->
match expr.node {
ast::ExprKind::Match(ref cond, _) => {
// `match `cond` {`
let cond_shape = match context.config.control_style() {
Style::Legacy => shape.shrink_left(6).and_then(|s| s.sub_width(2))?,
Style::Rfc => shape.offset_left(8)?,
let cond_shape = match context.config.indent_style() {
IndentStyle::Visual => shape.shrink_left(6).and_then(|s| s.sub_width(2))?,
IndentStyle::Block => shape.offset_left(8)?,
};
cond.rewrite(context, cond_shape)
}
@ -922,9 +922,9 @@ impl<'a> ControlFlow<'a> {
let pat_expr_string = match self.cond {
Some(cond) => {
let cond_shape = match context.config.control_style() {
Style::Legacy => constr_shape.shrink_left(offset)?,
Style::Rfc => constr_shape.offset_left(offset)?,
let cond_shape = match context.config.indent_style() {
IndentStyle::Visual => constr_shape.shrink_left(offset)?,
IndentStyle::Block => constr_shape.offset_left(offset)?,
};
rewrite_pat_expr(
context,
@ -951,7 +951,7 @@ impl<'a> ControlFlow<'a> {
.max_width()
.checked_sub(constr_shape.used_width() + offset + brace_overhead)
.unwrap_or(0);
let force_newline_brace = context.config.control_style() == Style::Rfc
let force_newline_brace = context.config.indent_style() == IndentStyle::Block
&& (pat_expr_string.contains('\n') || pat_expr_string.len() > one_line_budget)
&& !last_line_extendable(&pat_expr_string);
@ -1236,9 +1236,9 @@ fn rewrite_match(
..shape
};
// 6 = `match `
let cond_shape = match context.config.control_style() {
Style::Legacy => cond_shape.shrink_left(6)?,
Style::Rfc => cond_shape.offset_left(6)?,
let cond_shape = match context.config.indent_style() {
IndentStyle::Visual => cond_shape.shrink_left(6)?,
IndentStyle::Block => cond_shape.offset_left(6)?,
};
let cond_str = cond.rewrite(context, cond_shape)?;
let alt_block_sep = String::from("\n") + &shape.indent.block_only().to_string(context.config);
@ -1809,7 +1809,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_indent(
let nested_shape = shape_from_indent_style(
context,
shape,
used_width + 2 * paren_overhead,
@ -2058,7 +2058,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_indent() == IndentStyle::Visual && args_len > 1)
|| (context.config.indent_style() == IndentStyle::Visual && args_len > 1)
}
ast::ExprKind::If(..) |
ast::ExprKind::IfLet(..) |
@ -2070,7 +2070,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_indent() == IndentStyle::Visual && args_len > 1
|| context.config.indent_style() == IndentStyle::Visual && args_len > 1
}
ast::ExprKind::Array(..) |
ast::ExprKind::Call(..) |
@ -2319,7 +2319,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_indent() == Visual, but we run out
// FIXME if context.config.indent_style() == Visual, but we run out
// of space, we should fall back to BlockIndent.
}
@ -2330,7 +2330,7 @@ pub fn wrap_struct_field(
nested_shape: Shape,
one_line_width: usize,
) -> String {
if context.config.struct_lit_indent() == IndentStyle::Block
if context.config.indent_style() == IndentStyle::Block
&& (fields_str.contains('\n')
|| context.config.struct_lit_multiline_style() == MultilineStyle::ForceMulti
|| fields_str.len() > one_line_width)
@ -2401,7 +2401,7 @@ pub fn rewrite_field(
}
}
fn shape_from_fn_call_indent(
fn shape_from_indent_style(
context: &RewriteContext,
shape: Shape,
overhead: usize,

View file

@ -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, Style};
use config::{BraceStyle, Config, Density, IndentStyle, ReturnIndent};
use expr::{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,
@ -815,9 +815,9 @@ fn format_impl_ref_and_type(
result.push_str("for ");
}
let budget = context.budget(last_line_width(&result));
let type_offset = match context.config.where_style() {
Style::Legacy => new_line_offset + trait_ref_overhead,
Style::Rfc => new_line_offset,
let type_offset = match context.config.indent_style() {
IndentStyle::Visual => new_line_offset + trait_ref_overhead,
IndentStyle::Block => new_line_offset,
};
result.push_str(&*self_ty
.rewrite(context, Shape::legacy(budget, type_offset))?);
@ -974,8 +974,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_indent() == IndentStyle::Block))
|| (context.config.fn_args_indent() == IndentStyle::Block && result.is_empty())
&& (!result.contains('\n') || context.config.indent_style() == IndentStyle::Block))
|| (context.config.indent_style() == IndentStyle::Block && result.is_empty())
|| (context.config.where_density() == Density::CompressedIfEmpty && !has_body
&& !result.contains('\n'))
{
@ -1880,13 +1880,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_indent() == IndentStyle::Visual {
if context.config.indent_style() == IndentStyle::Visual {
arg_indent = arg_indent + 1; // extra space for `(`
}
result.push('(');
} else {
result.push_str("(");
if context.config.fn_args_indent() == IndentStyle::Visual {
if context.config.indent_style() == IndentStyle::Visual {
result.push('\n');
result.push_str(&arg_indent.to_string(context.config));
}
@ -1933,7 +1933,7 @@ fn rewrite_fn_base(
generics_str.contains('\n'),
)?;
let put_args_in_block = match context.config.fn_args_indent() {
let put_args_in_block = match context.config.indent_style() {
IndentStyle::Block => arg_str.contains('\n') || arg_str.len() > one_line_budget,
_ => false,
} && !fd.inputs.is_empty();
@ -1974,7 +1974,7 @@ fn rewrite_fn_base(
// Return type.
if let ast::FunctionRetTy::Ty(..) = fd.output {
let ret_should_indent = match context.config.fn_args_indent() {
let ret_should_indent = match context.config.indent_style() {
// 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,
@ -2266,7 +2266,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_indent() {
let (indent, trailing_comma) = match context.config.indent_style() {
IndentStyle::Block if fits_in_one_line => {
(indent.block_indent(context.config), SeparatorTactic::Never)
}
@ -2303,7 +2303,7 @@ fn rewrite_args(
},
separator_place: SeparatorPlace::Back,
shape: Shape::legacy(budget, indent),
ends_with_newline: tactic.ends_with_newline(context.config.fn_args_indent()),
ends_with_newline: tactic.ends_with_newline(context.config.indent_style()),
preserve_newline: true,
config: context.config,
};
@ -2353,7 +2353,7 @@ fn compute_budgets_for_args(
if one_line_budget > 0 {
// 4 = "() {".len()
let (indent, multi_line_budget) = match context.config.fn_args_indent() {
let (indent, multi_line_budget) = match context.config.indent_style() {
IndentStyle::Block => {
let indent = indent.block_indent(context.config);
(indent, context.budget(indent.width() + 1))
@ -2371,7 +2371,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_indent() {
let used_space = match context.config.indent_style() {
// 1 = `,`
IndentStyle::Block => new_indent.width() + 1,
// Account for `)` and possibly ` {`.
@ -2464,7 +2464,7 @@ fn rewrite_generics_inner(
}
pub fn generics_shape_from_config(config: &Config, shape: Shape, offset: usize) -> Option<Shape> {
match config.generics_indent() {
match config.indent_style() {
IndentStyle::Visual => shape.visual_indent(1 + offset).sub_width(offset + 2),
IndentStyle::Block => {
// 1 = ","
@ -2497,14 +2497,14 @@ where
let fmt = ListFormatting {
tactic: tactic,
separator: ",",
trailing_separator: if context.config.generics_indent() == IndentStyle::Visual {
trailing_separator: if context.config.indent_style() == IndentStyle::Visual {
SeparatorTactic::Never
} else {
context.config.trailing_comma()
},
separator_place: SeparatorPlace::Back,
shape: shape,
ends_with_newline: tactic.ends_with_newline(context.config.generics_indent()),
ends_with_newline: tactic.ends_with_newline(context.config.indent_style()),
preserve_newline: true,
config: context.config,
};
@ -2523,7 +2523,7 @@ pub fn wrap_generics_with_angle_brackets(
list_str: &str,
list_offset: Indent,
) -> String {
if context.config.generics_indent() == IndentStyle::Block
if context.config.indent_style() == IndentStyle::Block
&& (list_str.contains('\n') || list_str.ends_with(','))
{
format!(
@ -2674,7 +2674,7 @@ fn rewrite_where_clause(
return Some(String::new());
}
if context.config.where_style() == Style::Rfc {
if context.config.indent_style() == IndentStyle::Block {
return rewrite_where_clause_rfc_style(
context,
where_clause,
@ -2689,12 +2689,12 @@ fn rewrite_where_clause(
let extra_indent = Indent::new(context.config.tab_spaces(), 0);
let offset = match context.config.where_pred_indent() {
let offset = match context.config.indent_style() {
IndentStyle::Block => shape.indent + extra_indent.block_indent(context.config),
// 6 = "where ".len()
IndentStyle::Visual => shape.indent + extra_indent + 6,
};
// FIXME: if where_pred_indent != Visual, then the budgets below might
// FIXME: if indent_style != Visual, then the budgets below might
// be out by a char or two.
let budget = context.config.max_width() - offset.width();
@ -2737,7 +2737,7 @@ fn rewrite_where_clause(
trailing_separator: comma_tactic,
separator_place: SeparatorPlace::Back,
shape: Shape::legacy(budget, offset),
ends_with_newline: tactic.ends_with_newline(context.config.where_pred_indent()),
ends_with_newline: tactic.ends_with_newline(context.config.indent_style()),
preserve_newline: true,
config: context.config,
};

View file

@ -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_indent() {
let v_shape = match context.config.indent_style() {
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_indent(), items.len()) {
let prelim_tactic = match (context.config.indent_style(), 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_indent() != IndentStyle::Visual
let ends_with_newline = context.config.indent_style() != IndentStyle::Visual
&& tactic == DefinitiveListTactic::Vertical;
ListFormatting {
tactic: tactic,

View file

@ -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_indent() == IndentStyle::Block || self.use_block
self.config.indent_style() == IndentStyle::Block || self.use_block
}
pub fn budget(&self, used_width: usize) -> usize {

View file

@ -18,7 +18,7 @@ use syntax::symbol::keywords;
use spanned::Spanned;
use codemap::SpanUtils;
use config::{IndentStyle, Style, TypeDensity};
use config::{IndentStyle, TypeDensity};
use expr::{rewrite_pair, rewrite_tuple, rewrite_unary_prefix, wrap_args_with_parens, PairParts};
use items::{format_generics_item_list, generics_shape_from_config};
use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListTactic, Separator,
@ -302,7 +302,7 @@ where
// 2 for ()
let budget = shape.width.checked_sub(2)?;
// 1 for (
let offset = match context.config.fn_args_indent() {
let offset = match context.config.indent_style() {
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_indent()),
ends_with_newline: tactic.ends_with_newline(context.config.indent_style()),
preserve_newline: true,
config: context.config,
};
let list_str = write_list(&item_vec, &fmt)?;
let ty_shape = match context.config.fn_args_indent() {
let ty_shape = match context.config.indent_style() {
IndentStyle::Block => shape.block().block_indent(context.config.tab_spaces()),
IndentStyle::Visual => shape.block_left(4)?,
};
@ -447,9 +447,9 @@ impl Rewrite for ast::WherePredicate {
}
} else {
let used_width = type_str.len() + colon.len();
let ty_shape = match context.config.where_style() {
Style::Legacy => shape.block_left(used_width)?,
Style::Rfc => shape,
let ty_shape = match context.config.indent_style() {
IndentStyle::Visual => shape.block_left(used_width)?,
IndentStyle::Block => shape,
};
let bounds = bounds
.iter()