fix : width available

This commit is contained in:
Gaëtan Cassiers 2015-05-30 16:44:07 +02:00
parent 092d6be368
commit 38f421b764
2 changed files with 5 additions and 3 deletions

View File

@ -204,8 +204,9 @@ impl<'a> FmtVisitor<'a> {
.enumerate() .enumerate()
.map(|(i, item)| self.rewrite_expr( .map(|(i, item)| self.rewrite_expr(
item, item,
// for last line, -2 is for indent + ")", for other lines, -1 is for comma // last line : given width (minus "("+")"), other lines : max_width
if i == items.len() - 1 { width - 2 } else { config!(max_width) - indent - 1 }, // (minus "("+","))
if i == items.len() - 1 { width - 2 } else { config!(max_width) - indent - 2 },
indent)) indent))
.collect(); .collect();
let tactics = if item_strs.iter().any(|s| s.contains('\n')) { let tactics = if item_strs.iter().any(|s| s.contains('\n')) {

View File

@ -2,8 +2,9 @@
fn foo() { fn foo() {
let a = (a, a, a, a, a); let a = (a, a, a, a, a);
let aaaaaaaaaaaaaaaa = (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaa, aaaaaaaaaa); let aaaaaaaaaaaaaaaa = (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaa, aaaaaaaaaaaaaa);
let aaaaaaaaaaaaaaaaaaaaaa = (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, let aaaaaaaaaaaaaaaaaaaaaa = (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa,
aaaa); aaaa);
} }