mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-22 04:34:51 +00:00
Handle tuples of length 1
This commit is contained in:
parent
38f421b764
commit
7a6b4db819
@ -198,6 +198,10 @@ impl<'a> FmtVisitor<'a> {
|
||||
-> String {
|
||||
// opening paren
|
||||
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
|
||||
let item_strs: Vec<_> =
|
||||
items.iter()
|
||||
|
@ -7,4 +7,5 @@ fn foo() {
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
aaaa);
|
||||
let a = (a,);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user