Handle tuples of length 1
This commit is contained in:
parent
38f421b764
commit
7a6b4db819
2 changed files with 5 additions and 0 deletions
|
@ -198,6 +198,10 @@ impl<'a> FmtVisitor<'a> {
|
||||||
-> String {
|
-> String {
|
||||||
// opening paren
|
// opening paren
|
||||||
let indent = offset + 1;
|
let indent = offset + 1;
|
||||||
|
// In case of length 1, need a trailing comma
|
||||||
|
if items.len() == 1 {
|
||||||
|
return format!("({},)", self.rewrite_expr(&*items[0], width - 3, indent));
|
||||||
|
}
|
||||||
// Only last line has width-1 as budget, other may take max_width
|
// Only last line has width-1 as budget, other may take max_width
|
||||||
let item_strs: Vec<_> =
|
let item_strs: Vec<_> =
|
||||||
items.iter()
|
items.iter()
|
||||||
|
|
|
@ -7,4 +7,5 @@ fn foo() {
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaa,
|
aaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||||
aaaa);
|
aaaa);
|
||||||
|
let a = (a,);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue