Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sinhpham committed Sep 27, 2015
1 parent d7efdd6 commit 220ecda
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/types.rs
Expand Up @@ -482,6 +482,27 @@ impl Rewrite for ast::Ty {
let budget = try_opt!(width.checked_sub(2));
ty.rewrite(context, budget, offset + 1).map(|ty_str| format!("({})", ty_str))
}
ast::TyTup(ref tup_ret) => {
let inner = try_opt!(tup_ret.iter()
.map(|item| item.rewrite(context, width, offset))
.fold(Some("".to_owned()),
|sum, x| {
match (sum, x) {
(Some(sum), Some(x)) => {
if sum == "" {
// First item.
Some(x)
} else {
Some(sum + ", " + &x)
}
}
_ => None,
}
}));

let ret = format!("({})", inner);
wrap_str(ret, context.config.max_width, width, offset)
}
_ => wrap_str(pprust::ty_to_string(self),
context.config.max_width,
width,
Expand Down
3 changes: 3 additions & 0 deletions tests/target/fn.rs
Expand Up @@ -79,6 +79,9 @@ fn homura<T: Deref<Target = i32>>(_: T) {

}

fn issue377() -> (Box<CompositorProxy + Send>, Box<CompositorReceiver>) {
}

fn main() {
let _ = function(move || 5);
let _ = move || 42;
Expand Down

0 comments on commit 220ecda

Please sign in to comment.