diff options
| author | Marcus Klaas de Vries <mail@marcusklaas.nl> | 2015-11-14 22:00:11 +0100 |
|---|---|---|
| committer | Marcus Klaas de Vries <mail@marcusklaas.nl> | 2015-11-14 22:00:11 +0100 |
| commit | de599015de210205ccb4fa4619bc2add72d3647f (patch) | |
| tree | 5e3ccab5d4cae9f2c607577c915675c3c950d444 /src | |
| parent | 7fe92728491690d59e8bb101473c4be2cb271e30 (diff) | |
| parent | d4be6a43e98883c04d38b101c663ddf990e247f3 (diff) | |
Merge pull request #601 from thorbenk/chains_tabbed_indent
Chains tabbed indent
Diffstat (limited to 'src')
| -rw-r--r-- | src/chains.rs | 10 | ||||
| -rw-r--r-- | src/config.rs | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/chains.rs b/src/chains.rs index 9c5b37d35cb..31cd9624016 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -56,7 +56,15 @@ pub fn rewrite_chain(mut expr: &ast::Expr, } else if is_block_expr(parent, &parent_rewrite) { (parent_block_indent, false) } else { - (offset + Indent::new(context.config.tab_spaces, 0), false) + match context.config.chain_indent { + BlockIndentStyle::Inherit => (context.block_indent, false), + BlockIndentStyle::Tabbed => { + (context.block_indent.block_indent(context.config), false) + } + BlockIndentStyle::Visual => { + (offset + Indent::new(context.config.tab_spaces, 0), false) + } + } }; let max_width = try_opt!((width + offset.width()).checked_sub(indent.width())); diff --git a/src/config.rs b/src/config.rs index 9f260f93ab8..dcf0816335b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -294,6 +294,7 @@ create_config! { report_fixme: ReportTactic, ReportTactic::Never, "Report all, none or unnumbered occurrences of FIXME in source file comments"; chain_base_indent: BlockIndentStyle, BlockIndentStyle::Visual, "Indent on chain base"; + chain_indent: BlockIndentStyle, BlockIndentStyle::Visual, "Indentation of chain"; reorder_imports: bool, false, "Reorder import statements alphabetically"; single_line_if_else: bool, false, "Put else on same line as closing brace for if statements"; format_strings: bool, true, "Format string literals, or leave as is"; |
