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",
Config {
max_width: 100,
ideal_width: 80,
- leeway: 5,
tab_spaces: 4,
fn_call_width: 50,
struct_lit_width: 12,
// 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);
// 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 {
} 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,
};
// 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: ",",
// 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(),