Merge pull request #68 from marcusklaas/import-breaks
Keep import lists on a single line when possible
This commit is contained in:
commit
e2a5d94e3f
4 changed files with 44 additions and 30 deletions
|
@ -149,15 +149,16 @@ impl<'a, 'v> visit::Visitor<'v> for FmtVisitor<'a> {
|
|||
match vp.node {
|
||||
ast::ViewPath_::ViewPathList(ref path, ref path_list) => {
|
||||
let block_indent = self.block_indent;
|
||||
let budget = IDEAL_WIDTH - block_indent;
|
||||
if let Some(new_str) = self.rewrite_use_list(block_indent,
|
||||
budget,
|
||||
path,
|
||||
path_list,
|
||||
item.vis) {
|
||||
self.changes.push_str_span(item.span, &new_str);
|
||||
self.last_pos = item.span.hi;
|
||||
}
|
||||
let one_line_budget = MAX_WIDTH - block_indent;
|
||||
let multi_line_budget = IDEAL_WIDTH - block_indent;
|
||||
let new_str = self.rewrite_use_list(block_indent,
|
||||
one_line_budget,
|
||||
multi_line_budget,
|
||||
path,
|
||||
path_list,
|
||||
item.vis);
|
||||
self.changes.push_str_span(item.span, &new_str);
|
||||
self.last_pos = item.span.hi;
|
||||
}
|
||||
ast::ViewPath_::ViewPathGlob(_) => {
|
||||
// FIXME convert to list?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue