diff --git a/src/config.rs b/src/config.rs index 02076174482..b21fe3d2a07 100644 --- a/src/config.rs +++ b/src/config.rs @@ -216,7 +216,6 @@ macro_rules! create_config { create_config! { max_width: usize, "Maximum width of each line", ideal_width: usize, "Ideal width of each line (only used for comments)", - leeway: usize, "Leeway of line width (deprecated)", tab_spaces: usize, "Number of spaces per tab", fn_call_width: usize, "Maximum width of the args of a function call\ before faling back to vertical formatting", @@ -258,7 +257,6 @@ impl Default for Config { Config { max_width: 100, ideal_width: 80, - leeway: 5, tab_spaces: 4, fn_call_width: 50, struct_lit_width: 12, diff --git a/src/items.rs b/src/items.rs index 3cf12b68a82..13e06d0b438 100644 --- a/src/items.rs +++ b/src/items.rs @@ -528,7 +528,7 @@ impl<'a> FmtVisitor<'a> { // 2 = `()` let used_space = indent.width() + result.len() + 2; - let max_space = self.config.ideal_width + self.config.leeway; + let max_space = self.config.max_width; debug!("compute_budgets_for_args: used_space: {}, max_space: {}", used_space, max_space); @@ -542,7 +542,7 @@ impl<'a> FmtVisitor<'a> { // Didn't work. we must force vertical layout and put args on a newline. let new_indent = indent.block_indent(self.config); let used_space = new_indent.width() + 2; // account for `(` and `)` - let max_space = self.config.ideal_width + self.config.leeway; + let max_space = self.config.max_width; if used_space <= max_space { (0, max_space - used_space, new_indent) } else { @@ -637,7 +637,7 @@ impl<'a> FmtVisitor<'a> { } else { 0 }; - let budget = self.config.ideal_width - indent.width() - comma_cost - 1; // 1 = ) + let budget = self.config.max_width - indent.width() - comma_cost - 1; // 1 = ) let fmt = ListFormatting { tactic: ListTactic::HorizontalVertical, @@ -774,7 +774,7 @@ impl<'a> FmtVisitor<'a> { }; // 1 = , - let budget = self.config.ideal_width - offset.width() + self.config.tab_spaces - 1; + let budget = self.config.max_width - offset.width() + self.config.tab_spaces - 1; let fmt = ListFormatting { tactic: tactic, separator: ",", @@ -979,7 +979,7 @@ impl<'a> FmtVisitor<'a> { // FIXME: if where_pred_indent != Visual, then the budgets below might // be out by a char or two. - let budget = self.config.ideal_width + self.config.leeway - offset.width(); + let budget = self.config.max_width - offset.width(); let span_start = span_for_where_pred(&where_clause.predicates[0]).lo; let items = itemize_list(self.codemap, where_clause.predicates.iter(), diff --git a/tests/config/small_tabs.toml b/tests/config/small_tabs.toml index 754cde57cd9..1681aff77b4 100644 --- a/tests/config/small_tabs.toml +++ b/tests/config/small_tabs.toml @@ -1,6 +1,5 @@ max_width = 100 ideal_width = 80 -leeway = 5 tab_spaces = 2 newline_style = "Unix" fn_brace_style = "SameLineWhere"