Take width of return type into account

This commit is contained in:
Seiichi Uchida 2017-10-17 00:10:19 +09:00
parent 40e6c26b8b
commit 2bf4747c47

View File

@ -585,8 +585,6 @@ fn rewrite_closure_fn_decl(
};
let list_str = write_list(&item_vec, &fmt)?;
let mut prefix = format!("{}|{}|", mover, list_str);
// 1 = space between `|...|` and body.
let extra_offset = extra_offset(&prefix, shape) + 1;
if !ret_str.is_empty() {
if prefix.contains('\n') {
@ -597,6 +595,8 @@ fn rewrite_closure_fn_decl(
}
prefix.push_str(&ret_str);
}
// 1 = space between `|...|` and body.
let extra_offset = last_line_width(&prefix) + 1;
Some((prefix, extra_offset))
}